diff --git a/README.md b/README.md index ad3bf0b..03e2104 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Discord](https://img.shields.io/discord/1115206893015662663?label=Discord&logo=discord&logoColor=white&color=d82679)](https://discord.gg/Ca2xhfBf3v) ## Features 🔥 -- Fully generated C# SDK based on [OpenAPI specification](https://raw.githubusercontent.com/davidmigloz/langchain_dart/main/packages/anthropic_sdk_dart/oas/anthropic_openapi_curated.yaml) using [OpenApiGenerator](https://github.com/HavenDV/OpenApiGenerator) +- Fully generated C# SDK based on [official OpenAPI specification](https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/refs/heads/main/.stats.yml) using [AutoSDK](https://github.com/HavenDV/OpenApiGenerator) - Automatic releases of new preview versions if there was an update to the OpenAPI specification - Source generator to define tools natively through C# interfaces - All modern .NET features - nullability, trimming, NativeAOT, etc. diff --git a/src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj b/src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj index fbfc94e..3facc26 100644 --- a/src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj +++ b/src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj @@ -9,6 +9,7 @@ + diff --git a/src/helpers/FixOpenApiSpec/Program.cs b/src/helpers/FixOpenApiSpec/Program.cs index bfedcf7..d5fec01 100644 --- a/src/helpers/FixOpenApiSpec/Program.cs +++ b/src/helpers/FixOpenApiSpec/Program.cs @@ -1,34 +1,72 @@ +using AutoSDK.Helpers; using Microsoft.OpenApi; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; var path = args[0]; var jsonOrYaml = await File.ReadAllTextAsync(path); +if (OpenApi31Support.IsOpenApi31(jsonOrYaml)) +{ + jsonOrYaml = OpenApi31Support.ConvertToOpenApi30(jsonOrYaml); +} + var openApiDocument = new OpenApiStringReader().Read(jsonOrYaml, out var diagnostics); -openApiDocument.Components.Schemas["TextBlock"].Properties["type"].Enum = new List +openApiDocument.Components.Schemas.Add("Ping", new OpenApiSchema { - new OpenApiString("text"), -}; -openApiDocument.Components.Schemas["ImageBlock"].Properties["type"].Enum = new List -{ - new OpenApiString("image"), -}; -openApiDocument.Components.Schemas["ToolUseBlock"]!.Properties["type"].Enum = new List + Type = "object", + Properties = new Dictionary + { + ["type"] = new() + { + Enum = new List + { + new OpenApiString("ping"), + }, + Type = "string", + Default = new OpenApiString("ping"), + }, + }, + Required = new HashSet + { + "type", + }, +}); +openApiDocument.Components.Schemas["MessageStreamEvent"].OneOf.Add(new OpenApiSchema { - new OpenApiString("tool_use"), -}; -openApiDocument.Components.Schemas["ToolResultBlock"]!.Properties["type"].Enum = new List + Reference = new OpenApiReference + { + Type = ReferenceType.Schema, + Id = "Ping", + }, +}); + +openApiDocument.Components.SecuritySchemes.Clear(); +openApiDocument.Components.SecuritySchemes.Add("ApiKeyAuth", new OpenApiSecurityScheme { - new OpenApiString("tool_result"), -}; + Type = SecuritySchemeType.ApiKey, + In = ParameterLocation.Header, + Name = "x-api-key", +}); -openApiDocument.Components.Schemas["TextBlock"].Required.Add("type"); -openApiDocument.Components.Schemas["ImageBlock"].Required.Add("type"); -openApiDocument.Components.Schemas["ToolUseBlock"].Required.Add("type"); -openApiDocument.Components.Schemas["ToolResultBlock"].Required.Add("type"); +openApiDocument.SecurityRequirements.Clear(); +openApiDocument.SecurityRequirements.Add(new OpenApiSecurityRequirement +{ + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference + { + Type = ReferenceType.SecurityScheme, + Id = "ApiKeyAuth", + }, + }, + new List() + } +}); jsonOrYaml = openApiDocument.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0); _ = new OpenApiStringReader().Read(jsonOrYaml, out diagnostics); diff --git a/src/libs/Anthropic/AnthropicClient.Streaming.cs b/src/libs/Anthropic/AnthropicClient.Streaming.cs index 2488128..71ee739 100755 --- a/src/libs/Anthropic/AnthropicClient.Streaming.cs +++ b/src/libs/Anthropic/AnthropicClient.Streaming.cs @@ -1,5 +1,4 @@ -using System.Net.Http; -using System.Net.Http.Headers; +using System.Net.Http.Headers; using System.Runtime.CompilerServices; // ReSharper disable RedundantNameQualifier @@ -11,35 +10,39 @@ public partial class AnthropicClient { /// /// Create a Message
- /// Send a structured list of input messages with text and/or image content, and the
- /// model will generate the next message in the conversation.
- /// The Messages API can be used for either single queries or stateless multi-turn
- /// conversations. + /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// /// /// The token to cancel the operation with - /// + /// public async IAsyncEnumerable CreateMessageAsStreamAsync( - global::Anthropic.CreateMessageRequest request, + global::Anthropic.CreateMessageParams request, + string? anthropicVersion = default, [EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); request.Stream = true; - + PrepareArguments( client: HttpClient); - PrepareCreateMessageArguments( - httpClient: HttpClient, - request: request); var __pathBuilder = new PathBuilder( - path: "/messages", + path: "/v1/messages", baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); 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)); __httpRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/event-stream")); +#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) { @@ -56,6 +59,12 @@ public partial class AnthropicClient __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -66,10 +75,6 @@ public partial class AnthropicClient PrepareRequest( client: HttpClient, request: __httpRequest); - PrepareCreateMessageRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); using var __response = await HttpClient.SendAsync( request: __httpRequest, @@ -79,10 +84,52 @@ public partial class AnthropicClient ProcessResponse( client: HttpClient, response: __response); - ProcessCreateMessageResponse( - 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.ErrorResponse? __value_4XX = null; + if (ReadResponseAsString) + { + __content_4XX = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = global::Anthropic.ErrorResponse.FromJson(__content_4XX, JsonSerializerContext); + } + else + { + var __contentStream_4XX = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = await global::Anthropic.ErrorResponse.FromJsonStreamAsync(__contentStream_4XX, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::Anthropic.ApiException( + 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), + }; + } + + 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), + }; + } #if NET6_0_OR_GREATER using var __content = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); diff --git a/src/libs/Anthropic/Extensions/AnthropicClient.ChatClient.cs b/src/libs/Anthropic/Extensions/AnthropicClient.ChatClient.cs index c7c748a..4a3ad60 100644 --- a/src/libs/Anthropic/Extensions/AnthropicClient.ChatClient.cs +++ b/src/libs/Anthropic/Extensions/AnthropicClient.ChatClient.cs @@ -1,11 +1,5 @@ using Microsoft.Extensions.AI; -using System; -using System.Collections.Generic; -using System.Net; -using System.Reflection; using System.Runtime.CompilerServices; -using System.Text; -using System.Text.Json.Serialization; // ReSharper disable ConvertTypeCheckPatternToNullCheck // ReSharper disable once CheckNamespace @@ -14,14 +8,14 @@ namespace Anthropic; public partial class AnthropicClient : IChatClient { - private static readonly JsonElement s_defaultParameterSchema = JsonDocument.Parse("{}").RootElement; + private static readonly JsonElement DefaultParameterSchema = JsonDocument.Parse("{}").RootElement; private ChatClientMetadata? _metadata; /// ChatClientMetadata IChatClient.Metadata => _metadata ??= new(nameof(AnthropicClient), this.BaseUri); /// - object? IChatClient.GetService(Type serviceType, object? key) + object? IChatClient.GetService(Type? serviceType, object? key) { return key is null && serviceType?.IsInstanceOfType(this) is true ? this : null; } @@ -29,9 +23,9 @@ public partial class AnthropicClient : IChatClient async Task IChatClient.CompleteAsync( IList chatMessages, ChatOptions? options, CancellationToken cancellationToken) { - CreateMessageRequest request = CreateRequest(chatMessages, options); + CreateMessageParams request = CreateRequest(chatMessages, options); - var response = await this.CreateMessageAsync(request, cancellationToken).ConfigureAwait(false); + var response = await this.Messages.MessagesPostAsync(request, anthropicVersion: "2023-06-01", cancellationToken).ConfigureAwait(false); ChatMessage responseMessage = new() { @@ -44,33 +38,33 @@ async Task IChatClient.CompleteAsync( (responseMessage.AdditionalProperties ??= [])[nameof(response.StopSequence)] = response.StopSequence; } - if (response.Content.Value1 is string stringContents) + // if (response.Content.Value1 is string stringContents) + // { + // responseMessage.Contents.Add(new TextContent(stringContents)); + // } + //else if (response.Content.Value2 is IList blocks) { - responseMessage.Contents.Add(new TextContent(stringContents)); - } - else if (response.Content.Value2 is IList blocks) - { - foreach (var block in blocks) + foreach (var block in response.Content) { if (block.IsText) { responseMessage.Contents.Add(new TextContent(block.Text!.Text) { RawRepresentation = block.Text }); } - else if (block.IsImage) - { - responseMessage.Contents.Add(new ImageContent( - block.Image!.Source.Data, - block.Image!.Source.MediaType switch - { - ImageBlockSourceMediaType.ImagePng => "image/png", - ImageBlockSourceMediaType.ImageGif => "image/gif", - ImageBlockSourceMediaType.ImageWebp => "image/webp", - _ => "image/jpeg", - }) - { - RawRepresentation = block.Image - }); - } + // else if (block.IsImage) + // { + // responseMessage.Contents.Add(new ImageContent( + // block.Image!.Source.Data, + // block.Image!.Source.MediaType switch + // { + // ImageBlockSourceMediaType.ImagePng => "image/png", + // ImageBlockSourceMediaType.ImageGif => "image/gif", + // ImageBlockSourceMediaType.ImageWebp => "image/webp", + // _ => "image/jpeg", + // }) + // { + // RawRepresentation = block.Image + // }); + // } else if (block.IsToolUse) { responseMessage.Contents.Add(new FunctionCallContent( @@ -90,10 +84,10 @@ async Task IChatClient.CompleteAsync( FinishReason = response.StopReason switch { null => null, - StopReason.EndTurn or StopReason.StopSequence => ChatFinishReason.Stop, - StopReason.MaxTokens => ChatFinishReason.Length, - StopReason.ToolUse => ChatFinishReason.ToolCalls, - _ => new ChatFinishReason(response.StopReason.ToString()!), + MessageStopReason.EndTurn or MessageStopReason.StopSequence => ChatFinishReason.Stop, + MessageStopReason.MaxTokens => ChatFinishReason.Length, + MessageStopReason.ToolUse => ChatFinishReason.ToolCalls, + _ => new ChatFinishReason(response.StopReason.ToString()), }, }; @@ -106,15 +100,15 @@ async Task IChatClient.CompleteAsync( TotalTokenCount = u.InputTokens + u.OutputTokens, }; - if (u.CacheCreationInputTokens is not null) - { - (completion.Usage.AdditionalProperties ??= [])[nameof(u.CacheCreationInputTokens)] = u.CacheCreationInputTokens; - } - - if (u.CacheReadInputTokens is not null) - { - (completion.Usage.AdditionalProperties ??= [])[nameof(u.CacheReadInputTokens)] = u.CacheReadInputTokens; - } + // if (u.CacheCreationInputTokens is not null) + // { + // (completion.Usage.AdditionalProperties ??= [])[nameof(u.CacheCreationInputTokens)] = u.CacheCreationInputTokens; + // } + // + // if (u.CacheReadInputTokens is not null) + // { + // (completion.Usage.AdditionalProperties ??= [])[nameof(u.CacheReadInputTokens)] = u.CacheReadInputTokens; + // } } return completion; @@ -155,11 +149,11 @@ async IAsyncEnumerable IChatClient.CompleteStream } } - private static CreateMessageRequest CreateRequest(IList chatMessages, ChatOptions? options) + private static CreateMessageParams CreateRequest(IList chatMessages, ChatOptions? options) { string? systemMessage = null; - List messages = []; + List messages = []; foreach (var chatMessage in chatMessages) { if (chatMessage.Role == ChatRole.System) @@ -172,35 +166,35 @@ private static CreateMessageRequest CreateRequest(IList chatMessage continue; } - List blocks = []; + List blocks = []; foreach (var content in chatMessage.Contents) { switch (content) { case TextContent tc: - blocks.Add(new Block(new TextBlock() { Text = tc.Text })); + blocks.Add(new ContentVariant2Item2(new RequestTextBlock { Text = tc.Text })); break; case ImageContent ic when ic.ContainsData: - blocks.Add(new Block(new ImageBlock() + blocks.Add(new ContentVariant2Item2(new RequestImageBlock { - Source = new ImageBlockSource() + Source = new Base64ImageSource { MediaType = ic.MediaType switch { - "image/png" => ImageBlockSourceMediaType.ImagePng, - "image/gif" => ImageBlockSourceMediaType.ImageGif, - "image/webp" => ImageBlockSourceMediaType.ImageWebp, - _ => ImageBlockSourceMediaType.ImageJpeg, + "image/png" => Base64ImageSourceMediaType.ImagePng, + "image/gif" => Base64ImageSourceMediaType.ImageGif, + "image/webp" => Base64ImageSourceMediaType.ImageWebp, + _ => Base64ImageSourceMediaType.ImageJpeg, }, - Data = Convert.ToBase64String(ic.Data?.ToArray() ?? []), - Type = ImageBlockSourceType.Base64, + Data = ic.Data?.ToArray() ?? [], //Convert.ToBase64String(ic.Data?.ToArray() ?? []), + Type = Base64ImageSourceType.Base64, } })); break; case FunctionCallContent fcc: - blocks.Add(new Block(new ToolUseBlock() + blocks.Add(new ContentVariant2Item2(new RequestToolUseBlock { Id = fcc.CallId, Name = fcc.Name, @@ -209,7 +203,7 @@ private static CreateMessageRequest CreateRequest(IList chatMessage break; case FunctionResultContent frc: - blocks.Add(new Block(new ToolResultBlock() + blocks.Add(new ContentVariant2Item2(new RequestToolResultBlock { ToolUseId = frc.CallId, Content = frc.Result?.ToString() ?? string.Empty, @@ -218,18 +212,18 @@ private static CreateMessageRequest CreateRequest(IList chatMessage break; } - foreach (Block block in blocks) + foreach (ContentVariant2Item2 block in blocks) { - messages.Add(new Message() + messages.Add(new InputMessage { - Role = chatMessage.Role == ChatRole.Assistant ? MessageRole.Assistant : MessageRole.User, + Role = chatMessage.Role == ChatRole.Assistant ? InputMessageRole.Assistant : InputMessageRole.User, Content = new([block]) }); } } } - var request = new CreateMessageRequest() + var request = new CreateMessageParams { MaxTokens = options?.MaxOutputTokens ?? 250, Messages = messages, @@ -241,22 +235,23 @@ private static CreateMessageRequest CreateRequest(IList chatMessage TopK = options?.TopK, ToolChoice = options?.Tools is not { Count: > 0 } ? null: - options?.ToolMode is AutoChatToolMode ? new ToolChoice() { Type = ToolChoiceType.Auto } : - options?.ToolMode is RequiredChatToolMode r ? - new ToolChoice() - { - Type = r.RequiredFunctionName is not null ? ToolChoiceType.Tool : ToolChoiceType.Any, - Name = r.RequiredFunctionName - } : - null, - Tools = options?.Tools is IList tools ? - tools.OfType().Select(f => new Tool(new ToolCustom() - { - Name = f.Metadata.Name, - Description = f.Metadata.Description, - InputSchema = CreateSchema(f), - })).ToList() : - null, + options?.ToolMode is AutoChatToolMode ? new ToolChoice(new ToolChoiceAuto()) : + options?.ToolMode is RequiredChatToolMode r + ? r.RequiredFunctionName is not null + ? new ToolChoice(new ToolChoiceTool + { + Name = r.RequiredFunctionName, + }) + : new ToolChoice(new ToolChoiceAny()) + : (ToolChoice?)null, + // Tools = options?.Tools is IList tools ? + // tools.OfType().Select(f => new Tool + // { + // Name = f.Metadata.Name, + // Description = f.Metadata.Description, + // InputSchema = CreateSchema(f), + // }).ToList() : + // null, }; return request; } @@ -269,7 +264,7 @@ private static ToolParameterJsonSchema CreateSchema(AIFunction f) foreach (AIFunctionParameterMetadata parameter in parameters) { - tool.Properties.Add(parameter.Name, parameter.Schema is JsonElement e ? e : s_defaultParameterSchema); + tool.Properties.Add(parameter.Name, parameter.Schema is JsonElement e ? e : DefaultParameterSchema); if (parameter.IsRequired) { diff --git a/src/libs/Anthropic/Extensions/StringExtensions.cs b/src/libs/Anthropic/Extensions/StringExtensions.cs index c24a7f5..44acbc4 100755 --- a/src/libs/Anthropic/Extensions/StringExtensions.cs +++ b/src/libs/Anthropic/Extensions/StringExtensions.cs @@ -10,11 +10,11 @@ public static class StringExtensions /// /// /// - public static Message AsUserMessage(this string content) + public static InputMessage AsUserMessage(this string content) { - return new Message + return new InputMessage { - Role = MessageRole.User, + Role = InputMessageRole.User, Content = content, }; } @@ -24,11 +24,11 @@ public static Message AsUserMessage(this string content) /// /// /// - public static Message AsAssistantMessage(this string content) + public static InputMessage AsAssistantMessage(this string content) { - return new Message + return new InputMessage { - Role = MessageRole.Assistant, + Role = InputMessageRole.Assistant, Content = content, }; } @@ -39,16 +39,16 @@ public static Message AsAssistantMessage(this string content) /// /// /// - public static Message AsToolCall(this string content, ToolUseBlock toolUse) + public static InputMessage AsToolCall(this string content, ResponseToolUseBlock toolUse) { toolUse = toolUse ?? throw new ArgumentNullException(nameof(toolUse)); - return new Message + return new InputMessage { - Role = MessageRole.User, - Content = new List + Role = InputMessageRole.User, + Content = new List { - new ToolResultBlock + new RequestToolResultBlock { ToolUseId = toolUse.Id, Content = content, @@ -62,15 +62,34 @@ public static Message AsToolCall(this string content, ToolUseBlock toolUse) /// /// /// - public static Message AsRequestMessage(this Message message) + public static InputMessage AsInputMessage(this Message message) { message = message ?? throw new ArgumentNullException(nameof(message)); - return new Message + return new InputMessage { - Content = message.Content, - Role = message.Role, - StopSequence = message.StopSequence, + Content = message.Content.Select(x => + { + if (x.IsText) + { + return new ContentVariant2Item2(new RequestTextBlock + { + Text = x.Text!.Text, + }); + } + if (x.IsToolUse) + { + return new ContentVariant2Item2(new RequestToolUseBlock + { + Id = x.ToolUse!.Id, + Input = x.ToolUse.Input, + Name = x.ToolUse!.Name, + }); + } + + return new ContentVariant2Item2(); + }).ToList(), + Role = InputMessageRole.Assistant, }; } @@ -98,11 +117,11 @@ public static IList AsAnthropicTools( this IList tools) { return tools - .Select(x => (Tool)new ToolCustom + .Select(x => new Tool { Description = x.Description ?? string.Empty, Name = x.Name ?? string.Empty, - InputSchema = x.Parameters ?? new ToolCustomInputSchema(), + InputSchema = new InputSchema(), // x.Parameters ?? }) .ToList(); } diff --git a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.g.cs index 179c0e7..80615e5 100644 --- a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.g.cs @@ -4,7 +4,6 @@ namespace Anthropic { /// - /// API Spec for Anthropic API. Please see https://docs.anthropic.com/en/api 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. ///
@@ -13,7 +12,7 @@ public sealed partial class AnthropicClient : global::Anthropic.IAnthropicClient /// /// /// - public const string DefaultBaseUrl = "https://api.anthropic.com/v1"; + public const string DefaultBaseUrl = "https://api.anthropic.com"; private bool _disposeHttpClient = true; @@ -37,6 +36,33 @@ public sealed partial class AnthropicClient : global::Anthropic.IAnthropicClient public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Anthropic.SourceGenerationContext.Default; + /// + /// + /// + public MessagesClient Messages => new MessagesClient(HttpClient, authorizations: Authorizations) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContext = JsonSerializerContext, + }; + + /// + /// + /// + public TextCompletionsClient TextCompletions => new TextCompletionsClient(HttpClient, authorizations: Authorizations) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContext = JsonSerializerContext, + }; + + /// + /// + /// + public MessageBatchesClient MessageBatches => new MessageBatchesClient(HttpClient, authorizations: Authorizations) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContext = JsonSerializerContext, + }; + /// /// Creates a new instance of the AnthropicClient. /// If no httpClient is provided, a new one will be created. diff --git a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CreateMessage.g.cs b/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CreateMessage.g.cs deleted file mode 100644 index 0321787..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CreateMessage.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -#nullable enable - -namespace Anthropic -{ - public partial interface IAnthropicClient - { - /// - /// Create a Message
- /// Send a structured list of input messages with text and/or image content, and the
- /// model will generate the next message in the conversation.
- /// The Messages API can be used for either single queries or stateless multi-turn
- /// conversations. - ///
- /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task CreateMessageAsync( - global::Anthropic.CreateMessageRequest request, - global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Create a Message
- /// Send a structured list of input messages with text and/or image content, and the
- /// model will generate the next message in the conversation.
- /// The Messages API can be used for either single queries or stateless multi-turn
- /// conversations. - ///
- /// - /// The model that will complete your prompt.
- /// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
- /// details and options.
- /// Example: claude-3-5-sonnet-20241022 - /// - /// - /// Input messages.
- /// Our models are trained to operate on alternating `user` and `assistant`
- /// conversational turns. When creating a new `Message`, you specify the prior
- /// conversational turns with the `messages` parameter, and the model then generates
- /// the next `Message` in the conversation.
- /// Each input message must be an object with a `role` and `content`. You can
- /// specify a single `user`-role message, or you can include multiple `user` and
- /// `assistant` messages. The first message must always use the `user` role.
- /// If the final message uses the `assistant` role, the response content will
- /// continue immediately from the content in that message. This can be used to
- /// constrain part of the model's response.
- /// See [message content](https://docs.anthropic.com/en/api/messages-content) for
- /// details on how to construct valid message objects.
- /// Example with a single `user` message:
- /// ```json
- /// [{ "role": "user", "content": "Hello, Claude" }]
- /// ```
- /// Example with multiple conversational turns:
- /// ```json
- /// [
- /// { "role": "user", "content": "Hello there." },
- /// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
- /// { "role": "user", "content": "Can you explain LLMs in plain English?" }
- /// ]
- /// ```
- /// Example with a partially-filled response from Claude:
- /// ```json
- /// [
- /// {
- /// "role": "user",
- /// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
- /// },
- /// { "role": "assistant", "content": "The best answer is (" }
- /// ]
- /// ```
- /// Each input message `content` may be either a single `string` or an array of
- /// content blocks, where each block has a specific `type`. Using a `string` for
- /// `content` is shorthand for an array of one content block of type `"text"`. The
- /// following input messages are equivalent:
- /// ```json
- /// { "role": "user", "content": "Hello, Claude" }
- /// ```
- /// ```json
- /// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
- /// ```
- /// Starting with Claude 3 models, you can also send image content blocks:
- /// ```json
- /// {
- /// "role": "user",
- /// "content": [
- /// {
- /// "type": "image",
- /// "source": {
- /// "type": "base64",
- /// "media_type": "image/jpeg",
- /// "data": "/9j/4AAQSkZJRg..."
- /// }
- /// },
- /// { "type": "text", "text": "What is in this image?" }
- /// ]
- /// }
- /// ```
- /// We currently support the `base64` source type for images, and the `image/jpeg`,
- /// `image/png`, `image/gif`, and `image/webp` media types.
- /// See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
- /// input examples.
- /// Note that if you want to include a
- /// [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
- /// the top-level `system` parameter — there is no `"system"` role for input
- /// messages in the Messages API. - /// - /// - /// The maximum number of tokens to generate before stopping.
- /// Note that our models may stop _before_ reaching this maximum. This parameter
- /// only specifies the absolute maximum number of tokens to generate.
- /// Different models have different maximum values for this parameter. See
- /// [models](https://docs.anthropic.com/en/docs/models-overview) for details. - /// - /// - /// An object describing metadata about the request. - /// - /// - /// Custom text sequences that will cause the model to stop generating.
- /// Our models will normally stop when they have naturally completed their turn,
- /// which will result in a response `stop_reason` of `"end_turn"`.
- /// If you want the model to stop generating when it encounters custom strings of
- /// text, you can use the `stop_sequences` parameter. If the model encounters one of
- /// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
- /// and the response `stop_sequence` value will contain the matched stop sequence. - /// - /// - /// System prompt.
- /// A system prompt is a way of providing context and instructions to Claude, such
- /// as specifying a particular goal or role. See our
- /// [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). - /// - /// - /// Amount of randomness injected into the response.
- /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
- /// for analytical / multiple choice, and closer to `1.0` for creative and
- /// generative tasks.
- /// Note that even with `temperature` of `0.0`, the results will not be fully
- /// deterministic. - /// - /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. - /// - /// - /// Definitions of tools that the model may use.
- /// If you include `tools` in your API request, the model may return `tool_use`
- /// content blocks that represent the model's use of those tools. You can then run
- /// those tools using the tool input generated by the model and then optionally
- /// return results back to the model using `tool_result` content blocks.
- /// Each tool definition includes:
- /// - `name`: Name of the tool.
- /// - `description`: Optional, but strongly-recommended description of the tool.
- /// - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
- /// shape that the model will produce in `tool_use` output content blocks.
- /// For example, if you defined `tools` as:
- /// ```json
- /// [
- /// {
- /// "name": "get_stock_price",
- /// "description": "Get the current stock price for a given ticker symbol.",
- /// "input_schema": {
- /// "type": "object",
- /// "properties": {
- /// "ticker": {
- /// "type": "string",
- /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
- /// }
- /// },
- /// "required": ["ticker"]
- /// }
- /// }
- /// ]
- /// ```
- /// And then asked the model "What's the S&P 500 at today?", the model might produce
- /// `tool_use` content blocks in the response like this:
- /// ```json
- /// [
- /// {
- /// "type": "tool_use",
- /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
- /// "name": "get_stock_price",
- /// "input": { "ticker": "^GSPC" }
- /// }
- /// ]
- /// ```
- /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
- /// input, and return the following back to the model in a subsequent `user`
- /// message:
- /// ```json
- /// [
- /// {
- /// "type": "tool_result",
- /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
- /// "content": "259.75 USD"
- /// }
- /// ]
- /// ```
- /// Tools can be used for workflows that include running client-side tools and
- /// functions, or more generally whenever you want the model to produce a particular
- /// JSON structure of output.
- /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. - /// - /// - /// Only sample from the top K options for each subsequent token.
- /// Used to remove "long tail" low probability responses.
- /// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. - /// - /// - /// Use nucleus sampling.
- /// In nucleus sampling, we compute the cumulative distribution over all the options
- /// for each subsequent token in decreasing probability order and cut it off once it
- /// reaches a particular probability specified by `top_p`. You should either alter
- /// `temperature` or `top_p`, but not both.
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. - /// - /// - /// Whether to incrementally stream the response using server-sent events.
- /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
- /// details.
- /// Default Value: false - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task CreateMessageAsync( - global::Anthropic.AnyOf model, - global::System.Collections.Generic.IList messages, - int maxTokens, - global::Anthropic.CreateMessageRequestMetadata? metadata = default, - global::System.Collections.Generic.IList? stopSequences = default, - global::Anthropic.OneOf>? system = default, - double? temperature = default, - global::Anthropic.ToolChoice? toolChoice = default, - global::System.Collections.Generic.IList? tools = default, - int? topK = default, - double? topP = default, - bool? stream = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CreateMessageBatch.g.cs b/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CreateMessageBatch.g.cs deleted file mode 100644 index 6c16ed8..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CreateMessageBatch.g.cs +++ /dev/null @@ -1,31 +0,0 @@ -#nullable enable - -namespace Anthropic -{ - public partial interface IAnthropicClient - { - /// - /// Create a Message Batch
- /// Send a batch of Message creation requests. - ///
- /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task CreateMessageBatchAsync( - global::Anthropic.CreateMessageBatchRequest request, - global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Create a Message Batch
- /// Send a batch of Message creation requests. - ///
- /// - /// List of requests for prompt completion. Each is an individual request to create a Message. - /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task CreateMessageBatchAsync( - global::System.Collections.Generic.IList requests, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.RetrieveMessageBatch.g.cs b/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.RetrieveMessageBatch.g.cs deleted file mode 100644 index 455909a..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.RetrieveMessageBatch.g.cs +++ /dev/null @@ -1,20 +0,0 @@ -#nullable enable - -namespace Anthropic -{ - public partial interface IAnthropicClient - { - /// - /// Retrieve a Message Batch
- /// This endpoint is idempotent and can be used to poll for Message Batch
- /// completion. To access the results of a Message Batch, make a request to the
- /// `results_url` field in the response. - ///
- /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task RetrieveMessageBatchAsync( - string id, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.g.cs index 4e45e49..a3aa598 100644 --- a/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.g.cs @@ -4,7 +4,6 @@ namespace Anthropic { /// - /// API Spec for Anthropic API. Please see https://docs.anthropic.com/en/api 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. ///
@@ -37,5 +36,20 @@ public partial interface IAnthropicClient : global::System.IDisposable global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + /// + /// + /// + public MessagesClient Messages { get; } + + /// + /// + /// + public TextCompletionsClient TextCompletions { get; } + + /// + /// + /// + public MessageBatchesClient MessageBatches { get; } + } } \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesCancel.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesCancel.g.cs new file mode 100644 index 0000000..6275049 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesCancel.g.cs @@ -0,0 +1,31 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Cancel a Message Batch
+ /// Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
+ /// The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesCancelAsync( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesCancel2.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesCancel2.g.cs new file mode 100644 index 0000000..9b5fabe --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesCancel2.g.cs @@ -0,0 +1,31 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Cancel a Message Batch
+ /// Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
+ /// The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesCancel2Async( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesList.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesList.g.cs new file mode 100644 index 0000000..aca874a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesList.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// List Message Batches
+ /// List all Message Batches within a Workspace. Most recently created batches are returned first. + ///
+ /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + /// + /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + /// + /// + /// Number of items to return per page.
+ /// Defaults to `20`. Ranges from `1` to `100`.
+ /// Default Value: 20 + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesListAsync( + string? beforeId = default, + string? afterId = default, + int? limit = default, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesList2.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesList2.g.cs new file mode 100644 index 0000000..c1208f3 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesList2.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// List Message Batches
+ /// List all Message Batches within a Workspace. Most recently created batches are returned first. + ///
+ /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + /// + /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + /// + /// + /// Number of items to return per page.
+ /// Defaults to `20`. Ranges from `1` to `100`.
+ /// Default Value: 20 + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesList2Async( + string? beforeId = default, + string? afterId = default, + int? limit = default, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesPost.g.cs new file mode 100644 index 0000000..6cf1012 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesPost.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Create a Message Batch
+ /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesPostAsync( + global::Anthropic.BetaCreateMessageBatchParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a Message Batch
+ /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// List of requests for prompt completion. Each is an individual request to create a Message. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesPostAsync( + global::System.Collections.Generic.IList requests, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesPost2.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesPost2.g.cs new file mode 100644 index 0000000..19fda27 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesPost2.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Create a Message Batch
+ /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesPost2Async( + global::Anthropic.BetaCreateMessageBatchParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a Message Batch
+ /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// List of requests for prompt completion. Each is an individual request to create a Message. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesPost2Async( + global::System.Collections.Generic.IList requests, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesResults.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesResults.g.cs new file mode 100644 index 0000000..1b23864 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesResults.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Retrieve Message Batch results
+ /// Streams the results of a Message Batch as a `.jsonl` file.
+ /// Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesResultsAsync( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesResults2.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesResults2.g.cs new file mode 100644 index 0000000..eccdb10 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesResults2.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Retrieve Message Batch results
+ /// Streams the results of a Message Batch as a `.jsonl` file.
+ /// Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesResults2Async( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesRetrieve.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesRetrieve.g.cs new file mode 100644 index 0000000..d7861f1 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesRetrieve.g.cs @@ -0,0 +1,35 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Retrieve a Message Batch
+ /// This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesRetrieveAsync( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesRetrieve2.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesRetrieve2.g.cs new file mode 100644 index 0000000..cdca70f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.BetaMessageBatchesRetrieve2.g.cs @@ -0,0 +1,35 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessageBatchesClient + { + /// + /// Retrieve a Message Batch
+ /// This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessageBatchesRetrieve2Async( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.g.cs new file mode 100644 index 0000000..98154d5 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.g.cs @@ -0,0 +1,40 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// 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 IMessageBatchesClient : 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; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesCountTokensPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesCountTokensPost.g.cs new file mode 100644 index 0000000..c905518 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesCountTokensPost.g.cs @@ -0,0 +1,164 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessagesClient + { + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessagesCountTokensPostAsync( + global::Anthropic.BetaCountMessageTokensParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessagesCountTokensPostAsync( + global::System.Collections.Generic.IList messages, + global::Anthropic.Model model, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.BetaToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + global::Anthropic.AnyOf>? system = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesCountTokensPost2.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesCountTokensPost2.g.cs new file mode 100644 index 0000000..4cfee07 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesCountTokensPost2.g.cs @@ -0,0 +1,164 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessagesClient + { + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessagesCountTokensPost2Async( + global::Anthropic.BetaCountMessageTokensParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessagesCountTokensPost2Async( + global::System.Collections.Generic.IList messages, + global::Anthropic.Model model, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.BetaToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + global::Anthropic.AnyOf>? system = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesPost.g.cs new file mode 100644 index 0000000..15eaae6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.BetaMessagesPost.g.cs @@ -0,0 +1,207 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessagesClient + { + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessagesPostAsync( + global::Anthropic.BetaCreateMessageParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task BetaMessagesPostAsync( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.BetaMetadata? metadata = default, + global::System.Collections.Generic.IList? stopSequences = default, + bool? stream = default, + global::Anthropic.AnyOf>? system = default, + double? temperature = default, + global::Anthropic.BetaToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + int? topK = default, + double? topP = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.MessagesPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.MessagesPost.g.cs new file mode 100644 index 0000000..def8cea --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.MessagesPost.g.cs @@ -0,0 +1,197 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessagesClient + { + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task MessagesPostAsync( + global::Anthropic.CreateMessageParams request, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task MessagesPostAsync( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + string? anthropicVersion = default, + global::Anthropic.Metadata? metadata = default, + global::System.Collections.Generic.IList? stopSequences = default, + bool? stream = default, + global::Anthropic.AnyOf>? system = default, + double? temperature = default, + global::Anthropic.ToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + int? topK = default, + double? topP = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.PromptCachingBetaMessagesPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.PromptCachingBetaMessagesPost.g.cs new file mode 100644 index 0000000..4ad29a4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.PromptCachingBetaMessagesPost.g.cs @@ -0,0 +1,207 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface IMessagesClient + { + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PromptCachingBetaMessagesPostAsync( + global::Anthropic.PromptCachingBetaCreateMessageParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PromptCachingBetaMessagesPostAsync( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.Metadata? metadata = default, + global::System.Collections.Generic.IList? stopSequences = default, + bool? stream = default, + global::Anthropic.AnyOf>? system = default, + double? temperature = default, + global::Anthropic.ToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + int? topK = default, + double? topP = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.g.cs new file mode 100644 index 0000000..dcd9ea4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.IMessagesClient.g.cs @@ -0,0 +1,40 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// 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 IMessagesClient : 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; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.CompletePost.g.cs b/src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.CompletePost.g.cs new file mode 100644 index 0000000..e1d6ae0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.CompletePost.g.cs @@ -0,0 +1,98 @@ +#nullable enable + +namespace Anthropic +{ + public partial interface ITextCompletionsClient + { + /// + /// Create a Text Completion
+ /// [Legacy] Create a Text Completion.
+ /// The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
+ /// Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CompletePostAsync( + global::Anthropic.CompletionRequest request, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a Text Completion
+ /// [Legacy] Create a Text Completion.
+ /// The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
+ /// Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// The prompt that you want Claude to complete.
+ /// For proper response generation you will need to format your prompt using alternating `\n\nHuman:` and `\n\nAssistant:` conversational turns. For example:
+ /// ```
+ /// "\n\nHuman: {userQuestion}\n\nAssistant:"
+ /// ```
+ /// See [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more details.
+ /// Example:
+ /// Human: Hello, world!
+ /// Assistant: + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Example: 256 + /// + /// + /// Sequences that will cause the model to stop generating.
+ /// Our models stop on `"\n\nHuman:"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating. + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/streaming) for details. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CompletePostAsync( + global::Anthropic.Model model, + string prompt, + int maxTokensToSample, + string? anthropicVersion = default, + global::System.Collections.Generic.IList? stopSequences = default, + double? temperature = default, + double? topP = default, + int? topK = default, + global::Anthropic.Metadata? metadata = default, + bool? stream = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.g.cs new file mode 100644 index 0000000..8f11612 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.g.cs @@ -0,0 +1,40 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// 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 ITextCompletionsClient : 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; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesCancel.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesCancel.g.cs new file mode 100644 index 0000000..730639f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesCancel.g.cs @@ -0,0 +1,212 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesCancelArguments( + global::System.Net.Http.HttpClient httpClient, + ref string messageBatchId, + ref string? anthropicBeta, + ref string? anthropicVersion); + partial void PrepareBetaMessageBatchesCancelRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string messageBatchId, + string? anthropicBeta, + string? anthropicVersion); + partial void ProcessBetaMessageBatchesCancelResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesCancelResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Cancel a Message Batch
+ /// Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
+ /// The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesCancelAsync( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesCancelArguments( + httpClient: HttpClient, + messageBatchId: ref messageBatchId, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion); + + var __pathBuilder = new PathBuilder( + path: $"/v1/messages/batches/{messageBatchId}/cancel?beta=true", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + 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)); +#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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareBetaMessageBatchesCancelRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + messageBatchId: messageBatchId, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessBetaMessageBatchesCancelResponse( + 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( + 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); + ProcessBetaMessageBatchesCancelResponseContent( + 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.BetaMessageBatch.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.BetaMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.RetrieveMessageBatch.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesCancel2.g.cs similarity index 53% rename from src/libs/Anthropic/Generated/Anthropic.AnthropicClient.RetrieveMessageBatch.g.cs rename to src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesCancel2.g.cs index 7dece9d..66654b5 100644 --- a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.RetrieveMessageBatch.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesCancel2.g.cs @@ -3,49 +3,66 @@ namespace Anthropic { - public partial class AnthropicClient + public partial class MessageBatchesClient { - partial void PrepareRetrieveMessageBatchArguments( + partial void PrepareBetaMessageBatchesCancel2Arguments( global::System.Net.Http.HttpClient httpClient, - ref string id); - partial void PrepareRetrieveMessageBatchRequest( + ref string messageBatchId, + ref string? anthropicBeta, + ref string? anthropicVersion); + partial void PrepareBetaMessageBatchesCancel2Request( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string id); - partial void ProcessRetrieveMessageBatchResponse( + string messageBatchId, + string? anthropicBeta, + string? anthropicVersion); + partial void ProcessBetaMessageBatchesCancel2Response( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessRetrieveMessageBatchResponseContent( + partial void ProcessBetaMessageBatchesCancel2ResponseContent( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage, ref string content); /// - /// Retrieve a Message Batch
- /// This endpoint is idempotent and can be used to poll for Message Batch
- /// completion. To access the results of a Message Batch, make a request to the
- /// `results_url` field in the response. + /// Cancel a Message Batch
+ /// Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
+ /// The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. ///
- /// + /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task RetrieveMessageBatchAsync( - string id, + public async global::System.Threading.Tasks.Task BetaMessageBatchesCancel2Async( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); - PrepareRetrieveMessageBatchArguments( + PrepareBetaMessageBatchesCancel2Arguments( httpClient: HttpClient, - id: ref id); + messageBatchId: ref messageBatchId, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion); var __pathBuilder = new PathBuilder( - path: $"/messages/batches/{id}", + path: $"/v1/messages/batches/{messageBatchId}/cancel", baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Get, + method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); #if NET6_0_OR_GREATER __httpRequest.Version = global::System.Net.HttpVersion.Version11; @@ -68,13 +85,25 @@ partial void ProcessRetrieveMessageBatchResponseContent( } } + if (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + + PrepareRequest( client: HttpClient, request: __httpRequest); - PrepareRetrieveMessageBatchRequest( + PrepareBetaMessageBatchesCancel2Request( httpClient: HttpClient, httpRequestMessage: __httpRequest, - id: id); + messageBatchId: messageBatchId, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion); using var __response = await HttpClient.SendAsync( request: __httpRequest, @@ -84,9 +113,37 @@ partial void ProcessRetrieveMessageBatchResponseContent( ProcessResponse( client: HttpClient, response: __response); - ProcessRetrieveMessageBatchResponse( + ProcessBetaMessageBatchesCancel2Response( 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( + 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) { @@ -96,7 +153,7 @@ partial void ProcessRetrieveMessageBatchResponseContent( client: HttpClient, response: __response, content: ref __content); - ProcessRetrieveMessageBatchResponseContent( + ProcessBetaMessageBatchesCancel2ResponseContent( httpClient: HttpClient, httpResponseMessage: __response, content: ref __content); @@ -121,7 +178,7 @@ partial void ProcessRetrieveMessageBatchResponseContent( } return - global::Anthropic.MessageBatch.FromJson(__content, JsonSerializerContext) ?? + global::Anthropic.BetaMessageBatch.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else @@ -147,7 +204,7 @@ partial void ProcessRetrieveMessageBatchResponseContent( using var __content = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); return - await global::Anthropic.MessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + await global::Anthropic.BetaMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesList.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesList.g.cs new file mode 100644 index 0000000..5a4b0cc --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesList.g.cs @@ -0,0 +1,247 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesListArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? beforeId, + ref string? afterId, + ref int? limit, + ref string? anthropicBeta, + ref string? anthropicVersion, + ref string? xApiKey); + partial void PrepareBetaMessageBatchesListRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? beforeId, + string? afterId, + int? limit, + string? anthropicBeta, + string? anthropicVersion, + string? xApiKey); + partial void ProcessBetaMessageBatchesListResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesListResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List Message Batches
+ /// List all Message Batches within a Workspace. Most recently created batches are returned first. + ///
+ /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + /// + /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + /// + /// + /// Number of items to return per page.
+ /// Defaults to `20`. Ranges from `1` to `100`.
+ /// Default Value: 20 + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesListAsync( + string? beforeId = default, + string? afterId = default, + int? limit = default, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesListArguments( + httpClient: HttpClient, + beforeId: ref beforeId, + afterId: ref afterId, + limit: ref limit, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + xApiKey: ref xApiKey); + + var __pathBuilder = new PathBuilder( + path: "/v1/messages/batches?beta=true", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("before_id", beforeId) + .AddOptionalParameter("after_id", afterId) + .AddOptionalParameter("limit", limit?.ToString()) + ; + 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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + 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); + PrepareBetaMessageBatchesListRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + beforeId: beforeId, + afterId: afterId, + limit: limit, + anthropicBeta: anthropicBeta, + 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); + ProcessBetaMessageBatchesListResponse( + 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( + 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); + ProcessBetaMessageBatchesListResponseContent( + 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.BetaListResponseMessageBatch.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.BetaListResponseMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesList2.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesList2.g.cs new file mode 100644 index 0000000..b67270a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesList2.g.cs @@ -0,0 +1,247 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesList2Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string? beforeId, + ref string? afterId, + ref int? limit, + ref string? anthropicBeta, + ref string? anthropicVersion, + ref string? xApiKey); + partial void PrepareBetaMessageBatchesList2Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? beforeId, + string? afterId, + int? limit, + string? anthropicBeta, + string? anthropicVersion, + string? xApiKey); + partial void ProcessBetaMessageBatchesList2Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesList2ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List Message Batches
+ /// List all Message Batches within a Workspace. Most recently created batches are returned first. + ///
+ /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + /// + /// + /// ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + /// + /// + /// Number of items to return per page.
+ /// Defaults to `20`. Ranges from `1` to `100`.
+ /// Default Value: 20 + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesList2Async( + string? beforeId = default, + string? afterId = default, + int? limit = default, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesList2Arguments( + httpClient: HttpClient, + beforeId: ref beforeId, + afterId: ref afterId, + limit: ref limit, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + xApiKey: ref xApiKey); + + var __pathBuilder = new PathBuilder( + path: "/v1/messages/batches", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("before_id", beforeId) + .AddOptionalParameter("after_id", afterId) + .AddOptionalParameter("limit", limit?.ToString()) + ; + 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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + 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); + PrepareBetaMessageBatchesList2Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + beforeId: beforeId, + afterId: afterId, + limit: limit, + anthropicBeta: anthropicBeta, + 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); + ProcessBetaMessageBatchesList2Response( + 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( + 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); + ProcessBetaMessageBatchesList2ResponseContent( + 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.BetaListResponseMessageBatch.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.BetaListResponseMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CreateMessageBatch.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesPost.g.cs similarity index 55% rename from src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CreateMessageBatch.g.cs rename to src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesPost.g.cs index 4235691..6e09d23 100644 --- a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CreateMessageBatch.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesPost.g.cs @@ -3,45 +3,62 @@ namespace Anthropic { - public partial class AnthropicClient + public partial class MessageBatchesClient { - partial void PrepareCreateMessageBatchArguments( + partial void PrepareBetaMessageBatchesPostArguments( global::System.Net.Http.HttpClient httpClient, - global::Anthropic.CreateMessageBatchRequest request); - partial void PrepareCreateMessageBatchRequest( + ref string? anthropicBeta, + ref string? anthropicVersion, + global::Anthropic.BetaCreateMessageBatchParams request); + partial void PrepareBetaMessageBatchesPostRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, - global::Anthropic.CreateMessageBatchRequest request); - partial void ProcessCreateMessageBatchResponse( + string? anthropicBeta, + string? anthropicVersion, + global::Anthropic.BetaCreateMessageBatchParams request); + partial void ProcessBetaMessageBatchesPostResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessCreateMessageBatchResponseContent( + partial void ProcessBetaMessageBatchesPostResponseContent( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage, ref string content); /// /// Create a Message Batch
- /// Send a batch of Message creation requests. + /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreateMessageBatchAsync( - global::Anthropic.CreateMessageBatchRequest request, + public async global::System.Threading.Tasks.Task BetaMessageBatchesPostAsync( + global::Anthropic.BetaCreateMessageBatchParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( client: HttpClient); - PrepareCreateMessageBatchArguments( + PrepareBetaMessageBatchesPostArguments( httpClient: HttpClient, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, request: request); var __pathBuilder = new PathBuilder( - path: "/messages/batches", + path: "/v1/messages/batches?beta=true", baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( @@ -67,6 +84,16 @@ partial void ProcessCreateMessageBatchResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -77,9 +104,11 @@ partial void ProcessCreateMessageBatchResponseContent( PrepareRequest( client: HttpClient, request: __httpRequest); - PrepareCreateMessageBatchRequest( + PrepareBetaMessageBatchesPostRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, request: request); using var __response = await HttpClient.SendAsync( @@ -90,9 +119,37 @@ partial void ProcessCreateMessageBatchResponseContent( ProcessResponse( client: HttpClient, response: __response); - ProcessCreateMessageBatchResponse( + ProcessBetaMessageBatchesPostResponse( 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( + 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) { @@ -102,7 +159,7 @@ partial void ProcessCreateMessageBatchResponseContent( client: HttpClient, response: __response, content: ref __content); - ProcessCreateMessageBatchResponseContent( + ProcessBetaMessageBatchesPostResponseContent( httpClient: HttpClient, httpResponseMessage: __response, content: ref __content); @@ -127,7 +184,7 @@ partial void ProcessCreateMessageBatchResponseContent( } return - global::Anthropic.MessageBatch.FromJson(__content, JsonSerializerContext) ?? + global::Anthropic.BetaMessageBatch.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else @@ -153,30 +210,43 @@ partial void ProcessCreateMessageBatchResponseContent( using var __content = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); return - await global::Anthropic.MessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + await global::Anthropic.BetaMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); } } /// /// Create a Message Batch
- /// Send a batch of Message creation requests. + /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// /// /// List of requests for prompt completion. Each is an individual request to create a Message. /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreateMessageBatchAsync( - global::System.Collections.Generic.IList requests, + public async global::System.Threading.Tasks.Task BetaMessageBatchesPostAsync( + global::System.Collections.Generic.IList requests, + string? anthropicBeta = default, + string? anthropicVersion = default, global::System.Threading.CancellationToken cancellationToken = default) { - var __request = new global::Anthropic.CreateMessageBatchRequest + var __request = new global::Anthropic.BetaCreateMessageBatchParams { Requests = requests, }; - return await CreateMessageBatchAsync( + return await BetaMessageBatchesPostAsync( + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesPost2.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesPost2.g.cs new file mode 100644 index 0000000..c9f5927 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesPost2.g.cs @@ -0,0 +1,254 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesPost2Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string? anthropicBeta, + ref string? anthropicVersion, + global::Anthropic.BetaCreateMessageBatchParams request); + partial void PrepareBetaMessageBatchesPost2Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? anthropicBeta, + string? anthropicVersion, + global::Anthropic.BetaCreateMessageBatchParams request); + partial void ProcessBetaMessageBatchesPost2Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesPost2ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create a Message Batch
+ /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesPost2Async( + global::Anthropic.BetaCreateMessageBatchParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesPost2Arguments( + httpClient: HttpClient, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/v1/messages/batches", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + 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)); +#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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareBetaMessageBatchesPost2Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessBetaMessageBatchesPost2Response( + 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( + 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); + ProcessBetaMessageBatchesPost2ResponseContent( + 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.BetaMessageBatch.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.BetaMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Create a Message Batch
+ /// Send a batch of Message creation requests.
+ /// The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// List of requests for prompt completion. Each is an individual request to create a Message. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesPost2Async( + global::System.Collections.Generic.IList requests, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Anthropic.BetaCreateMessageBatchParams + { + Requests = requests, + }; + + return await BetaMessageBatchesPost2Async( + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesResults.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesResults.g.cs new file mode 100644 index 0000000..6386a06 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesResults.g.cs @@ -0,0 +1,225 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesResultsArguments( + global::System.Net.Http.HttpClient httpClient, + ref string messageBatchId, + ref string? anthropicBeta, + ref string? anthropicVersion, + ref string? xApiKey); + partial void PrepareBetaMessageBatchesResultsRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string messageBatchId, + string? anthropicBeta, + string? anthropicVersion, + string? xApiKey); + partial void ProcessBetaMessageBatchesResultsResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesResultsResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Retrieve Message Batch results
+ /// Streams the results of a Message Batch as a `.jsonl` file.
+ /// Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesResultsAsync( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesResultsArguments( + httpClient: HttpClient, + messageBatchId: ref messageBatchId, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + xApiKey: ref xApiKey); + + var __pathBuilder = new PathBuilder( + path: $"/v1/messages/batches/{messageBatchId}/results?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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + 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); + PrepareBetaMessageBatchesResultsRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + messageBatchId: messageBatchId, + anthropicBeta: anthropicBeta, + 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); + ProcessBetaMessageBatchesResultsResponse( + 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( + 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); + ProcessBetaMessageBatchesResultsResponseContent( + 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::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(byte[]), JsonSerializerContext) as byte[] ?? + 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::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(byte[]), JsonSerializerContext).ConfigureAwait(false) as byte[] ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesResults2.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesResults2.g.cs new file mode 100644 index 0000000..5ccc176 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesResults2.g.cs @@ -0,0 +1,225 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesResults2Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string messageBatchId, + ref string? anthropicBeta, + ref string? anthropicVersion, + ref string? xApiKey); + partial void PrepareBetaMessageBatchesResults2Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string messageBatchId, + string? anthropicBeta, + string? anthropicVersion, + string? xApiKey); + partial void ProcessBetaMessageBatchesResults2Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesResults2ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Retrieve Message Batch results
+ /// Streams the results of a Message Batch as a `.jsonl` file.
+ /// Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesResults2Async( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesResults2Arguments( + httpClient: HttpClient, + messageBatchId: ref messageBatchId, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + xApiKey: ref xApiKey); + + var __pathBuilder = new PathBuilder( + path: $"/v1/messages/batches/{messageBatchId}/results", + 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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + 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); + PrepareBetaMessageBatchesResults2Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + messageBatchId: messageBatchId, + anthropicBeta: anthropicBeta, + 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); + ProcessBetaMessageBatchesResults2Response( + 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( + 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); + ProcessBetaMessageBatchesResults2ResponseContent( + 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::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(byte[]), JsonSerializerContext) as byte[] ?? + 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::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(byte[]), JsonSerializerContext).ConfigureAwait(false) as byte[] ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesRetrieve.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesRetrieve.g.cs new file mode 100644 index 0000000..03d2de2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesRetrieve.g.cs @@ -0,0 +1,224 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesRetrieveArguments( + global::System.Net.Http.HttpClient httpClient, + ref string messageBatchId, + ref string? anthropicBeta, + ref string? anthropicVersion, + ref string? xApiKey); + partial void PrepareBetaMessageBatchesRetrieveRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string messageBatchId, + string? anthropicBeta, + string? anthropicVersion, + string? xApiKey); + partial void ProcessBetaMessageBatchesRetrieveResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesRetrieveResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Retrieve a Message Batch
+ /// This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesRetrieveAsync( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesRetrieveArguments( + httpClient: HttpClient, + messageBatchId: ref messageBatchId, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + xApiKey: ref xApiKey); + + var __pathBuilder = new PathBuilder( + path: $"/v1/messages/batches/{messageBatchId}?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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + 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); + PrepareBetaMessageBatchesRetrieveRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + messageBatchId: messageBatchId, + anthropicBeta: anthropicBeta, + 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); + ProcessBetaMessageBatchesRetrieveResponse( + 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( + 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); + ProcessBetaMessageBatchesRetrieveResponseContent( + 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.BetaMessageBatch.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.BetaMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesRetrieve2.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesRetrieve2.g.cs new file mode 100644 index 0000000..d1cf21c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.BetaMessageBatchesRetrieve2.g.cs @@ -0,0 +1,224 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessageBatchesClient + { + partial void PrepareBetaMessageBatchesRetrieve2Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string messageBatchId, + ref string? anthropicBeta, + ref string? anthropicVersion, + ref string? xApiKey); + partial void PrepareBetaMessageBatchesRetrieve2Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string messageBatchId, + string? anthropicBeta, + string? anthropicVersion, + string? xApiKey); + partial void ProcessBetaMessageBatchesRetrieve2Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessageBatchesRetrieve2ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Retrieve a Message Batch
+ /// This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + ///
+ /// + /// ID of the Message Batch. + /// + /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// Your unique API key for authentication.
+ /// 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. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessageBatchesRetrieve2Async( + string messageBatchId, + string? anthropicBeta = default, + string? anthropicVersion = default, + string? xApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareBetaMessageBatchesRetrieve2Arguments( + httpClient: HttpClient, + messageBatchId: ref messageBatchId, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + xApiKey: ref xApiKey); + + var __pathBuilder = new PathBuilder( + path: $"/v1/messages/batches/{messageBatchId}", + 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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + 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); + PrepareBetaMessageBatchesRetrieve2Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + messageBatchId: messageBatchId, + anthropicBeta: anthropicBeta, + 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); + ProcessBetaMessageBatchesRetrieve2Response( + 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( + 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); + ProcessBetaMessageBatchesRetrieve2ResponseContent( + 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.BetaMessageBatch.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.BetaMessageBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.g.cs new file mode 100644 index 0000000..470d473 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.g.cs @@ -0,0 +1,86 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// 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 MessageBatchesClient : global::Anthropic.IMessageBatchesClient, global::System.IDisposable + { + /// + /// + /// + public const string DefaultBaseUrl = "https://api.anthropic.com"; + + 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; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Anthropic.SourceGenerationContext.Default; + + + /// + /// Creates a new instance of the MessageBatchesClient. + /// 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 MessageBatchesClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = 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(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesCountTokensPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesCountTokensPost.g.cs new file mode 100644 index 0000000..112a39b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesCountTokensPost.g.cs @@ -0,0 +1,369 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessagesClient + { + partial void PrepareBetaMessagesCountTokensPostArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? anthropicBeta, + ref string? anthropicVersion, + global::Anthropic.BetaCountMessageTokensParams request); + partial void PrepareBetaMessagesCountTokensPostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? anthropicBeta, + string? anthropicVersion, + global::Anthropic.BetaCountMessageTokensParams request); + partial void ProcessBetaMessagesCountTokensPostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessagesCountTokensPostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessagesCountTokensPostAsync( + global::Anthropic.BetaCountMessageTokensParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareBetaMessagesCountTokensPostArguments( + httpClient: HttpClient, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/v1/messages/count_tokens?beta=true", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + 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)); +#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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareBetaMessagesCountTokensPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessBetaMessagesCountTokensPostResponse( + 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( + 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); + ProcessBetaMessagesCountTokensPostResponseContent( + 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.BetaCountMessageTokensResponse.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.BetaCountMessageTokensResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessagesCountTokensPostAsync( + global::System.Collections.Generic.IList messages, + global::Anthropic.Model model, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.BetaToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + global::Anthropic.AnyOf>? system = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Anthropic.BetaCountMessageTokensParams + { + ToolChoice = toolChoice, + Tools = tools, + Messages = messages, + System = system, + Model = model, + }; + + return await BetaMessagesCountTokensPostAsync( + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesCountTokensPost2.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesCountTokensPost2.g.cs new file mode 100644 index 0000000..3feec18 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesCountTokensPost2.g.cs @@ -0,0 +1,369 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessagesClient + { + partial void PrepareBetaMessagesCountTokensPost2Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string? anthropicBeta, + ref string? anthropicVersion, + global::Anthropic.BetaCountMessageTokensParams request); + partial void PrepareBetaMessagesCountTokensPost2Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? anthropicBeta, + string? anthropicVersion, + global::Anthropic.BetaCountMessageTokensParams request); + partial void ProcessBetaMessagesCountTokensPost2Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessagesCountTokensPost2ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessagesCountTokensPost2Async( + global::Anthropic.BetaCountMessageTokensParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareBetaMessagesCountTokensPost2Arguments( + httpClient: HttpClient, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/v1/messages/count_tokens", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + 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)); +#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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareBetaMessagesCountTokensPost2Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessBetaMessagesCountTokensPost2Response( + 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( + 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); + ProcessBetaMessagesCountTokensPost2ResponseContent( + 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.BetaCountMessageTokensResponse.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.BetaCountMessageTokensResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Count tokens in a Message
+ /// Count the number of tokens in a Message.
+ /// The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessagesCountTokensPost2Async( + global::System.Collections.Generic.IList messages, + global::Anthropic.Model model, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.BetaToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + global::Anthropic.AnyOf>? system = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Anthropic.BetaCountMessageTokensParams + { + ToolChoice = toolChoice, + Tools = tools, + Messages = messages, + System = system, + Model = model, + }; + + return await BetaMessagesCountTokensPost2Async( + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesPost.g.cs new file mode 100644 index 0000000..f4819e8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.BetaMessagesPost.g.cs @@ -0,0 +1,419 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessagesClient + { + partial void PrepareBetaMessagesPostArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? anthropicBeta, + ref string? anthropicVersion, + global::Anthropic.BetaCreateMessageParams request); + partial void PrepareBetaMessagesPostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? anthropicBeta, + string? anthropicVersion, + global::Anthropic.BetaCreateMessageParams request); + partial void ProcessBetaMessagesPostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessBetaMessagesPostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessagesPostAsync( + global::Anthropic.BetaCreateMessageParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareBetaMessagesPostArguments( + httpClient: HttpClient, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/v1/messages?beta=true", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + 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)); +#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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareBetaMessagesPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessBetaMessagesPostResponse( + 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( + 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); + ProcessBetaMessagesPostResponseContent( + 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.BetaMessage.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.BetaMessage.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task BetaMessagesPostAsync( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.BetaMetadata? metadata = default, + global::System.Collections.Generic.IList? stopSequences = default, + bool? stream = default, + global::Anthropic.AnyOf>? system = default, + double? temperature = default, + global::Anthropic.BetaToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + int? topK = default, + double? topP = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Anthropic.BetaCreateMessageParams + { + Model = model, + Messages = messages, + MaxTokens = maxTokens, + Metadata = metadata, + StopSequences = stopSequences, + Stream = stream, + System = system, + Temperature = temperature, + ToolChoice = toolChoice, + Tools = tools, + TopK = topK, + TopP = topP, + }; + + return await BetaMessagesPostAsync( + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CreateMessage.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.MessagesPost.g.cs similarity index 60% rename from src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CreateMessage.g.cs rename to src/libs/Anthropic/Generated/Anthropic.MessagesClient.MessagesPost.g.cs index 0f95fc9..ac6fe15 100644 --- a/src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CreateMessage.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.MessagesPost.g.cs @@ -3,48 +3,54 @@ namespace Anthropic { - public partial class AnthropicClient + public partial class MessagesClient { - partial void PrepareCreateMessageArguments( + partial void PrepareMessagesPostArguments( global::System.Net.Http.HttpClient httpClient, - global::Anthropic.CreateMessageRequest request); - partial void PrepareCreateMessageRequest( + ref string? anthropicVersion, + global::Anthropic.CreateMessageParams request); + partial void PrepareMessagesPostRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, - global::Anthropic.CreateMessageRequest request); - partial void ProcessCreateMessageResponse( + string? anthropicVersion, + global::Anthropic.CreateMessageParams request); + partial void ProcessMessagesPostResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessCreateMessageResponseContent( + partial void ProcessMessagesPostResponseContent( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage, ref string content); /// /// Create a Message
- /// Send a structured list of input messages with text and/or image content, and the
- /// model will generate the next message in the conversation.
- /// The Messages API can be used for either single queries or stateless multi-turn
- /// conversations. + /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreateMessageAsync( - global::Anthropic.CreateMessageRequest request, + public async global::System.Threading.Tasks.Task MessagesPostAsync( + global::Anthropic.CreateMessageParams request, + string? anthropicVersion = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( client: HttpClient); - PrepareCreateMessageArguments( + PrepareMessagesPostArguments( httpClient: HttpClient, + anthropicVersion: ref anthropicVersion, request: request); var __pathBuilder = new PathBuilder( - path: "/messages", + path: "/v1/messages", baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( @@ -70,6 +76,12 @@ partial void ProcessCreateMessageResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -80,9 +92,10 @@ partial void ProcessCreateMessageResponseContent( PrepareRequest( client: HttpClient, request: __httpRequest); - PrepareCreateMessageRequest( + PrepareMessagesPostRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, + anthropicVersion: anthropicVersion, request: request); using var __response = await HttpClient.SendAsync( @@ -93,9 +106,37 @@ partial void ProcessCreateMessageResponseContent( ProcessResponse( client: HttpClient, response: __response); - ProcessCreateMessageResponse( + ProcessMessagesPostResponse( 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.ErrorResponse? __value_4XX = null; + if (ReadResponseAsString) + { + __content_4XX = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = global::Anthropic.ErrorResponse.FromJson(__content_4XX, JsonSerializerContext); + } + else + { + var __contentStream_4XX = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = await global::Anthropic.ErrorResponse.FromJsonStreamAsync(__contentStream_4XX, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::Anthropic.ApiException( + 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) { @@ -105,7 +146,7 @@ partial void ProcessCreateMessageResponseContent( client: HttpClient, response: __response, content: ref __content); - ProcessCreateMessageResponseContent( + ProcessMessagesPostResponseContent( httpClient: HttpClient, httpResponseMessage: __response, content: ref __content); @@ -163,140 +204,104 @@ partial void ProcessCreateMessageResponseContent( /// /// Create a Message
- /// Send a structured list of input messages with text and/or image content, and the
- /// model will generate the next message in the conversation.
- /// The Messages API can be used for either single queries or stateless multi-turn
- /// conversations. + /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// /// - /// The model that will complete your prompt.
- /// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
- /// details and options.
- /// Example: claude-3-5-sonnet-20241022 + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. /// /// /// Input messages.
- /// Our models are trained to operate on alternating `user` and `assistant`
- /// conversational turns. When creating a new `Message`, you specify the prior
- /// conversational turns with the `messages` parameter, and the model then generates
- /// the next `Message` in the conversation.
- /// Each input message must be an object with a `role` and `content`. You can
- /// specify a single `user`-role message, or you can include multiple `user` and
- /// `assistant` messages. The first message must always use the `user` role.
- /// If the final message uses the `assistant` role, the response content will
- /// continue immediately from the content in that message. This can be used to
- /// constrain part of the model's response.
- /// See [message content](https://docs.anthropic.com/en/api/messages-content) for
- /// details on how to construct valid message objects.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
/// Example with a single `user` message:
/// ```json
- /// [{ "role": "user", "content": "Hello, Claude" }]
+ /// [{"role": "user", "content": "Hello, Claude"}]
/// ```
/// Example with multiple conversational turns:
/// ```json
/// [
- /// { "role": "user", "content": "Hello there." },
- /// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
- /// { "role": "user", "content": "Can you explain LLMs in plain English?" }
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
/// ]
/// ```
/// Example with a partially-filled response from Claude:
/// ```json
/// [
- /// {
- /// "role": "user",
- /// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
- /// },
- /// { "role": "assistant", "content": "The best answer is (" }
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
/// ]
/// ```
- /// Each input message `content` may be either a single `string` or an array of
- /// content blocks, where each block has a specific `type`. Using a `string` for
- /// `content` is shorthand for an array of one content block of type `"text"`. The
- /// following input messages are equivalent:
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
/// ```json
- /// { "role": "user", "content": "Hello, Claude" }
+ /// {"role": "user", "content": "Hello, Claude"}
/// ```
/// ```json
- /// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
/// ```
/// Starting with Claude 3 models, you can also send image content blocks:
/// ```json
- /// {
- /// "role": "user",
- /// "content": [
- /// {
- /// "type": "image",
- /// "source": {
- /// "type": "base64",
- /// "media_type": "image/jpeg",
- /// "data": "/9j/4AAQSkZJRg..."
- /// }
- /// },
- /// { "type": "text", "text": "What is in this image?" }
- /// ]
- /// }
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
/// ```
- /// We currently support the `base64` source type for images, and the `image/jpeg`,
- /// `image/png`, `image/gif`, and `image/webp` media types.
- /// See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
- /// input examples.
- /// Note that if you want to include a
- /// [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
- /// the top-level `system` parameter — there is no `"system"` role for input
- /// messages in the Messages API. + /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. /// /// /// The maximum number of tokens to generate before stopping.
- /// Note that our models may stop _before_ reaching this maximum. This parameter
- /// only specifies the absolute maximum number of tokens to generate.
- /// Different models have different maximum values for this parameter. See
- /// [models](https://docs.anthropic.com/en/docs/models-overview) for details. + /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 /// /// /// An object describing metadata about the request. /// /// /// Custom text sequences that will cause the model to stop generating.
- /// Our models will normally stop when they have naturally completed their turn,
- /// which will result in a response `stop_reason` of `"end_turn"`.
- /// If you want the model to stop generating when it encounters custom strings of
- /// text, you can use the `stop_sequences` parameter. If the model encounters one of
- /// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
- /// and the response `stop_sequence` value will contain the matched stop sequence. + /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. /// /// /// System prompt.
- /// A system prompt is a way of providing context and instructions to Claude, such
- /// as specifying a particular goal or role. See our
- /// [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). + /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] /// /// /// Amount of randomness injected into the response.
- /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
- /// for analytical / multiple choice, and closer to `1.0` for creative and
- /// generative tasks.
- /// Note that even with `temperature` of `0.0`, the results will not be fully
- /// deterministic. + /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 /// /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. /// /// /// Definitions of tools that the model may use.
- /// If you include `tools` in your API request, the model may return `tool_use`
- /// content blocks that represent the model's use of those tools. You can then run
- /// those tools using the tool input generated by the model and then optionally
- /// return results back to the model using `tool_result` content blocks.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
/// Each tool definition includes:
- /// - `name`: Name of the tool.
- /// - `description`: Optional, but strongly-recommended description of the tool.
- /// - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
- /// shape that the model will produce in `tool_use` output content blocks.
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
/// For example, if you defined `tools` as:
/// ```json
/// [
@@ -316,8 +321,7 @@ partial void ProcessCreateMessageResponseContent( /// }
/// ]
/// ```
- /// And then asked the model "What's the S&P 500 at today?", the model might produce
- /// `tool_use` content blocks in the response like this:
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
/// ```json
/// [
/// {
@@ -328,9 +332,7 @@ partial void ProcessCreateMessageResponseContent( /// }
/// ]
/// ```
- /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
- /// input, and return the following back to the model in a subsequent `user`
- /// message:
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
/// ```json
/// [
/// {
@@ -340,67 +342,57 @@ partial void ProcessCreateMessageResponseContent( /// }
/// ]
/// ```
- /// Tools can be used for workflows that include running client-side tools and
- /// functions, or more generally whenever you want the model to produce a particular
- /// JSON structure of output.
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
/// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. /// /// /// Only sample from the top K options for each subsequent token.
- /// Used to remove "long tail" low probability responses.
- /// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. + /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 /// /// /// Use nucleus sampling.
- /// In nucleus sampling, we compute the cumulative distribution over all the options
- /// for each subsequent token in decreasing probability order and cut it off once it
- /// reaches a particular probability specified by `top_p`. You should either alter
- /// `temperature` or `top_p`, but not both.
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. - /// - /// - /// Whether to incrementally stream the response using server-sent events.
- /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
- /// details.
- /// Default Value: false + /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreateMessageAsync( - global::Anthropic.AnyOf model, - global::System.Collections.Generic.IList messages, + public async global::System.Threading.Tasks.Task MessagesPostAsync( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, int maxTokens, - global::Anthropic.CreateMessageRequestMetadata? metadata = default, + string? anthropicVersion = default, + global::Anthropic.Metadata? metadata = default, global::System.Collections.Generic.IList? stopSequences = default, - global::Anthropic.OneOf>? system = default, + bool? stream = default, + global::Anthropic.AnyOf>? system = default, double? temperature = default, global::Anthropic.ToolChoice? toolChoice = default, global::System.Collections.Generic.IList? tools = default, int? topK = default, double? topP = default, - bool? stream = default, global::System.Threading.CancellationToken cancellationToken = default) { - var __request = new global::Anthropic.CreateMessageRequest + var __request = new global::Anthropic.CreateMessageParams { Model = model, Messages = messages, MaxTokens = maxTokens, Metadata = metadata, StopSequences = stopSequences, + Stream = stream, System = system, Temperature = temperature, ToolChoice = toolChoice, Tools = tools, TopK = topK, TopP = topP, - Stream = stream, }; - return await CreateMessageAsync( + return await MessagesPostAsync( + anthropicVersion: anthropicVersion, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/libs/Anthropic/Generated/Anthropic.MessagesClient.PromptCachingBetaMessagesPost.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.PromptCachingBetaMessagesPost.g.cs new file mode 100644 index 0000000..958698e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.PromptCachingBetaMessagesPost.g.cs @@ -0,0 +1,419 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class MessagesClient + { + partial void PreparePromptCachingBetaMessagesPostArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? anthropicBeta, + ref string? anthropicVersion, + global::Anthropic.PromptCachingBetaCreateMessageParams request); + partial void PreparePromptCachingBetaMessagesPostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? anthropicBeta, + string? anthropicVersion, + global::Anthropic.PromptCachingBetaCreateMessageParams request); + partial void ProcessPromptCachingBetaMessagesPostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPromptCachingBetaMessagesPostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PromptCachingBetaMessagesPostAsync( + global::Anthropic.PromptCachingBetaCreateMessageParams request, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePromptCachingBetaMessagesPostArguments( + httpClient: HttpClient, + anthropicBeta: ref anthropicBeta, + anthropicVersion: ref anthropicVersion, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/v1/messages?beta=prompt_caching", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + 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)); +#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 (anthropicBeta != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-beta", anthropicBeta.ToString()); + } + if (anthropicVersion != default) + { + __httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePromptCachingBetaMessagesPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPromptCachingBetaMessagesPostResponse( + 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.ErrorResponse? __value_4XX = null; + if (ReadResponseAsString) + { + __content_4XX = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = global::Anthropic.ErrorResponse.FromJson(__content_4XX, JsonSerializerContext); + } + else + { + var __contentStream_4XX = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = await global::Anthropic.ErrorResponse.FromJsonStreamAsync(__contentStream_4XX, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::Anthropic.ApiException( + 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); + ProcessPromptCachingBetaMessagesPostResponseContent( + 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.PromptCachingBetaMessage.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.PromptCachingBetaMessage.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Create a Message
+ /// Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
+ /// The Messages API can be used for either single queries or stateless multi-turn conversations. + ///
+ /// + /// Optional header to specify the beta version(s) you want to use.
+ /// To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta. + /// + /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PromptCachingBetaMessagesPostAsync( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + string? anthropicBeta = default, + string? anthropicVersion = default, + global::Anthropic.Metadata? metadata = default, + global::System.Collections.Generic.IList? stopSequences = default, + bool? stream = default, + global::Anthropic.AnyOf>? system = default, + double? temperature = default, + global::Anthropic.ToolChoice? toolChoice = default, + global::System.Collections.Generic.IList? tools = default, + int? topK = default, + double? topP = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Anthropic.PromptCachingBetaCreateMessageParams + { + Model = model, + Messages = messages, + MaxTokens = maxTokens, + Metadata = metadata, + StopSequences = stopSequences, + Stream = stream, + System = system, + Temperature = temperature, + ToolChoice = toolChoice, + Tools = tools, + TopK = topK, + TopP = topP, + }; + + return await PromptCachingBetaMessagesPostAsync( + anthropicBeta: anthropicBeta, + anthropicVersion: anthropicVersion, + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.MessagesClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.g.cs new file mode 100644 index 0000000..8160952 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.MessagesClient.g.cs @@ -0,0 +1,86 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// 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 MessagesClient : global::Anthropic.IMessagesClient, global::System.IDisposable + { + /// + /// + /// + public const string DefaultBaseUrl = "https://api.anthropic.com"; + + 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; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Anthropic.SourceGenerationContext.Default; + + + /// + /// Creates a new instance of the MessagesClient. + /// 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 MessagesClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = 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(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.APIError.Json.g.cs similarity index 88% rename from src/libs/Anthropic/Generated/Anthropic.Models.TextBlock.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.APIError.Json.g.cs index 6e616a5..a00f116 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlock.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.APIError.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class TextBlock + public sealed partial class APIError { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.TextBlock? FromJson( + public static global::Anthropic.APIError? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.TextBlock), - jsonSerializerContext) as global::Anthropic.TextBlock; + typeof(global::Anthropic.APIError), + jsonSerializerContext) as global::Anthropic.APIError; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.TextBlock? FromJson( + public static global::Anthropic.APIError? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.TextBlock), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.TextBlock; + typeof(global::Anthropic.APIError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.APIError; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.APIError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.APIError.g.cs new file mode 100644 index 0000000..7c48ee4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.APIError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class APIError + { + /// + /// Default Value: api_error + /// + /// global::Anthropic.APIErrorType.ApiError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.APIErrorTypeJsonConverter))] + public global::Anthropic.APIErrorType Type { get; set; } = global::Anthropic.APIErrorType.ApiError; + + /// + /// Default Value: Internal server error + /// + /// "Internal server error" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Internal server error"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: api_error + /// + /// + /// Default Value: Internal server error + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public APIError( + string message, + global::Anthropic.APIErrorType type = global::Anthropic.APIErrorType.ApiError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public APIError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.APIErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.APIErrorType.g.cs new file mode 100644 index 0000000..c4d9149 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.APIErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: api_error + /// + public enum APIErrorType + { + /// + /// + /// + ApiError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class APIErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this APIErrorType value) + { + return value switch + { + APIErrorType.ApiError => "api_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static APIErrorType? ToEnum(string value) + { + return value switch + { + "api_error" => APIErrorType.ApiError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/OneOf.2.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBeta.Json.g.cs similarity index 88% rename from src/libs/Anthropic/Generated/OneOf.2.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBeta.Json.g.cs index 7ace408..673af2e 100644 --- a/src/libs/Anthropic/Generated/OneOf.2.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBeta.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public readonly partial struct OneOf + public readonly partial struct AnthropicBeta { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.OneOf? FromJson( + public static global::Anthropic.AnthropicBeta? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.OneOf), - jsonSerializerContext) as global::Anthropic.OneOf?; + typeof(global::Anthropic.AnthropicBeta), + jsonSerializerContext) as global::Anthropic.AnthropicBeta?; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.OneOf? FromJson( + public static global::Anthropic.AnthropicBeta? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize>( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask?> FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.OneOf), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.OneOf?; + typeof(global::Anthropic.AnthropicBeta), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.AnthropicBeta?; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask?> FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync?>( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBeta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBeta.g.cs new file mode 100644 index 0000000..affc646 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBeta.g.cs @@ -0,0 +1,214 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct AnthropicBeta : global::System.IEquatable + { + /// + /// + /// +#if NET6_0_OR_GREATER + public string? Value1 { get; init; } +#else + public string? Value1 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value1))] +#endif + public bool IsValue1 => Value1 != null; + + /// + /// + /// + public static implicit operator AnthropicBeta(string value) => new AnthropicBeta(value); + + /// + /// + /// + public static implicit operator string?(AnthropicBeta @this) => @this.Value1; + + /// + /// + /// + public AnthropicBeta(string? value) + { + Value1 = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.AnthropicBetaEnum? Value2 { get; init; } +#else + public global::Anthropic.AnthropicBetaEnum? Value2 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))] +#endif + public bool IsValue2 => Value2 != null; + + /// + /// + /// + public static implicit operator AnthropicBeta(global::Anthropic.AnthropicBetaEnum value) => new AnthropicBeta(value); + + /// + /// + /// + public static implicit operator global::Anthropic.AnthropicBetaEnum?(AnthropicBeta @this) => @this.Value2; + + /// + /// + /// + public AnthropicBeta(global::Anthropic.AnthropicBetaEnum? value) + { + Value2 = value; + } + + /// + /// + /// + public AnthropicBeta( + string? value1, + global::Anthropic.AnthropicBetaEnum? value2 + ) + { + Value1 = value1; + Value2 = value2; + } + + /// + /// + /// + public object? Object => + Value2 as object ?? + Value1 as object + ; + + /// + /// + /// + public bool Validate() + { + return IsValue1 || IsValue2; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? value1 = null, + global::System.Func? value2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsValue1 && value1 != null) + { + return value1(Value1!); + } + else if (IsValue2 && value2 != null) + { + return value2(Value2!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? value1 = null, + global::System.Action? value2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsValue1) + { + value1?.Invoke(Value1!); + } + else if (IsValue2) + { + value2?.Invoke(Value2!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Value1, + typeof(string), + Value2, + typeof(global::Anthropic.AnthropicBetaEnum), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(AnthropicBeta other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Value1, other.Value1) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Value2, other.Value2) + ; + } + + /// + /// + /// + public static bool operator ==(AnthropicBeta obj1, AnthropicBeta obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(AnthropicBeta obj1, AnthropicBeta obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is AnthropicBeta o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBetaEnum.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBetaEnum.g.cs new file mode 100644 index 0000000..3ef4f29 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBetaEnum.g.cs @@ -0,0 +1,69 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum AnthropicBetaEnum + { + /// + /// + /// + MessageBatches20240924, + /// + /// + /// + PromptCaching20240731, + /// + /// + /// + ComputerUse20241022, + /// + /// + /// + Pdfs20240925, + /// + /// + /// + TokenCounting20241101, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class AnthropicBetaEnumExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this AnthropicBetaEnum value) + { + return value switch + { + AnthropicBetaEnum.MessageBatches20240924 => "message-batches-2024-09-24", + AnthropicBetaEnum.PromptCaching20240731 => "prompt-caching-2024-07-31", + AnthropicBetaEnum.ComputerUse20241022 => "computer-use-2024-10-22", + AnthropicBetaEnum.Pdfs20240925 => "pdfs-2024-09-25", + AnthropicBetaEnum.TokenCounting20241101 => "token-counting-2024-11-01", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static AnthropicBetaEnum? ToEnum(string value) + { + return value switch + { + "message-batches-2024-09-24" => AnthropicBetaEnum.MessageBatches20240924, + "prompt-caching-2024-07-31" => AnthropicBetaEnum.PromptCaching20240731, + "computer-use-2024-10-22" => AnthropicBetaEnum.ComputerUse20241022, + "pdfs-2024-09-25" => AnthropicBetaEnum.Pdfs20240925, + "token-counting-2024-11-01" => AnthropicBetaEnum.TokenCounting20241101, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BatchMessageRequest.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationError.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.BatchMessageRequest.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationError.Json.g.cs index 4ef03d5..0ac10de 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BatchMessageRequest.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationError.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class BatchMessageRequest + public sealed partial class AuthenticationError { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.BatchMessageRequest? FromJson( + public static global::Anthropic.AuthenticationError? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.BatchMessageRequest), - jsonSerializerContext) as global::Anthropic.BatchMessageRequest; + typeof(global::Anthropic.AuthenticationError), + jsonSerializerContext) as global::Anthropic.AuthenticationError; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.BatchMessageRequest? FromJson( + public static global::Anthropic.AuthenticationError? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.BatchMessageRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BatchMessageRequest; + typeof(global::Anthropic.AuthenticationError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.AuthenticationError; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationError.g.cs new file mode 100644 index 0000000..2ffa44c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class AuthenticationError + { + /// + /// Default Value: authentication_error + /// + /// global::Anthropic.AuthenticationErrorType.AuthenticationError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AuthenticationErrorTypeJsonConverter))] + public global::Anthropic.AuthenticationErrorType Type { get; set; } = global::Anthropic.AuthenticationErrorType.AuthenticationError; + + /// + /// Default Value: Authentication error + /// + /// "Authentication error" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Authentication error"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: authentication_error + /// + /// + /// Default Value: Authentication error + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticationError( + string message, + global::Anthropic.AuthenticationErrorType type = global::Anthropic.AuthenticationErrorType.AuthenticationError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public AuthenticationError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationErrorType.g.cs new file mode 100644 index 0000000..5552139 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.AuthenticationErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: authentication_error + /// + public enum AuthenticationErrorType + { + /// + /// + /// + AuthenticationError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class AuthenticationErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this AuthenticationErrorType value) + { + return value switch + { + AuthenticationErrorType.AuthenticationError => "authentication_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static AuthenticationErrorType? ToEnum(string value) + { + return value switch + { + "authentication_error" => AuthenticationErrorType.AuthenticationError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSource.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolDiscriminator.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSource.Json.g.cs index 19f52df..0e37e1f 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolDiscriminator.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSource.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolDiscriminator + public sealed partial class Base64ImageSource { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolDiscriminator? FromJson( + public static global::Anthropic.Base64ImageSource? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolDiscriminator), - jsonSerializerContext) as global::Anthropic.ToolDiscriminator; + typeof(global::Anthropic.Base64ImageSource), + jsonSerializerContext) as global::Anthropic.Base64ImageSource; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolDiscriminator? FromJson( + public static global::Anthropic.Base64ImageSource? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolDiscriminator), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolDiscriminator; + typeof(global::Anthropic.Base64ImageSource), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Base64ImageSource; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSource.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSource.g.cs new file mode 100644 index 0000000..064074f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSource.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class Base64ImageSource + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.Base64ImageSourceTypeJsonConverter))] + public global::Anthropic.Base64ImageSourceType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("media_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.Base64ImageSourceMediaTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Base64ImageSourceMediaType MediaType { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] Data { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Base64ImageSource( + global::Anthropic.Base64ImageSourceMediaType mediaType, + byte[] data, + global::Anthropic.Base64ImageSourceType type) + { + this.MediaType = mediaType; + this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public Base64ImageSource() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSourceMediaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSourceMediaType.g.cs similarity index 54% rename from src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSourceMediaType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSourceMediaType.g.cs index da68b99..3860c88 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSourceMediaType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSourceMediaType.g.cs @@ -4,9 +4,9 @@ namespace Anthropic { /// - /// The media type of the image. + /// /// - public enum ImageBlockSourceMediaType + public enum Base64ImageSourceMediaType { /// /// @@ -29,33 +29,33 @@ public enum ImageBlockSourceMediaType /// /// Enum extensions to do fast conversions without the reflection. /// - public static class ImageBlockSourceMediaTypeExtensions + public static class Base64ImageSourceMediaTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this ImageBlockSourceMediaType value) + public static string ToValueString(this Base64ImageSourceMediaType value) { return value switch { - ImageBlockSourceMediaType.ImageJpeg => "image/jpeg", - ImageBlockSourceMediaType.ImagePng => "image/png", - ImageBlockSourceMediaType.ImageGif => "image/gif", - ImageBlockSourceMediaType.ImageWebp => "image/webp", + Base64ImageSourceMediaType.ImageJpeg => "image/jpeg", + Base64ImageSourceMediaType.ImagePng => "image/png", + Base64ImageSourceMediaType.ImageGif => "image/gif", + Base64ImageSourceMediaType.ImageWebp => "image/webp", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static ImageBlockSourceMediaType? ToEnum(string value) + public static Base64ImageSourceMediaType? ToEnum(string value) { return value switch { - "image/jpeg" => ImageBlockSourceMediaType.ImageJpeg, - "image/png" => ImageBlockSourceMediaType.ImagePng, - "image/gif" => ImageBlockSourceMediaType.ImageGif, - "image/webp" => ImageBlockSourceMediaType.ImageWebp, + "image/jpeg" => Base64ImageSourceMediaType.ImageJpeg, + "image/png" => Base64ImageSourceMediaType.ImagePng, + "image/gif" => Base64ImageSourceMediaType.ImageGif, + "image/webp" => Base64ImageSourceMediaType.ImageWebp, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSourceType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSourceType.g.cs similarity index 66% rename from src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSourceType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSourceType.g.cs index 254a1b2..2cc204a 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSourceType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Base64ImageSourceType.g.cs @@ -4,9 +4,9 @@ namespace Anthropic { /// - /// The type of image source. + /// /// - public enum ImageBlockSourceType + public enum Base64ImageSourceType { /// /// @@ -17,27 +17,27 @@ public enum ImageBlockSourceType /// /// Enum extensions to do fast conversions without the reflection. /// - public static class ImageBlockSourceTypeExtensions + public static class Base64ImageSourceTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this ImageBlockSourceType value) + public static string ToValueString(this Base64ImageSourceType value) { return value switch { - ImageBlockSourceType.Base64 => "base64", + Base64ImageSourceType.Base64 => "base64", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static ImageBlockSourceType? ToEnum(string value) + public static Base64ImageSourceType? ToEnum(string value) { return value switch { - "base64" => ImageBlockSourceType.Base64, + "base64" => Base64ImageSourceType.Base64, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIError.Json.g.cs new file mode 100644 index 0000000..d88a7d7 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaAPIError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaAPIError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaAPIError), + jsonSerializerContext) as global::Anthropic.BetaAPIError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaAPIError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaAPIError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaAPIError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIError.g.cs new file mode 100644 index 0000000..a55c51f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaAPIError + { + /// + /// Default Value: api_error + /// + /// global::Anthropic.BetaAPIErrorType.ApiError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaAPIErrorTypeJsonConverter))] + public global::Anthropic.BetaAPIErrorType Type { get; set; } = global::Anthropic.BetaAPIErrorType.ApiError; + + /// + /// Default Value: Internal server error + /// + /// "Internal server error" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Internal server error"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: api_error + /// + /// + /// Default Value: Internal server error + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaAPIError( + string message, + global::Anthropic.BetaAPIErrorType type = global::Anthropic.BetaAPIErrorType.ApiError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaAPIError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIErrorType.g.cs new file mode 100644 index 0000000..5db9243 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAPIErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: api_error + /// + public enum BetaAPIErrorType + { + /// + /// + /// + ApiError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaAPIErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaAPIErrorType value) + { + return value switch + { + BetaAPIErrorType.ApiError => "api_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaAPIErrorType? ToEnum(string value) + { + return value switch + { + "api_error" => BetaAPIErrorType.ApiError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationError.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminator.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationError.Json.g.cs index f6d3982..bb6dceb 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminator.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationError.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class BlockDeltaDiscriminator + public sealed partial class BetaAuthenticationError { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.BlockDeltaDiscriminator? FromJson( + public static global::Anthropic.BetaAuthenticationError? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.BlockDeltaDiscriminator), - jsonSerializerContext) as global::Anthropic.BlockDeltaDiscriminator; + typeof(global::Anthropic.BetaAuthenticationError), + jsonSerializerContext) as global::Anthropic.BetaAuthenticationError; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.BlockDeltaDiscriminator? FromJson( + public static global::Anthropic.BetaAuthenticationError? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.BlockDeltaDiscriminator), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BlockDeltaDiscriminator; + typeof(global::Anthropic.BetaAuthenticationError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaAuthenticationError; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationError.g.cs new file mode 100644 index 0000000..6a4c03d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaAuthenticationError + { + /// + /// Default Value: authentication_error + /// + /// global::Anthropic.BetaAuthenticationErrorType.AuthenticationError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaAuthenticationErrorTypeJsonConverter))] + public global::Anthropic.BetaAuthenticationErrorType Type { get; set; } = global::Anthropic.BetaAuthenticationErrorType.AuthenticationError; + + /// + /// Default Value: Authentication error + /// + /// "Authentication error" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Authentication error"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: authentication_error + /// + /// + /// Default Value: Authentication error + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaAuthenticationError( + string message, + global::Anthropic.BetaAuthenticationErrorType type = global::Anthropic.BetaAuthenticationErrorType.AuthenticationError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaAuthenticationError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationErrorType.g.cs new file mode 100644 index 0000000..4b1f597 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaAuthenticationErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: authentication_error + /// + public enum BetaAuthenticationErrorType + { + /// + /// + /// + AuthenticationError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaAuthenticationErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaAuthenticationErrorType value) + { + return value switch + { + BetaAuthenticationErrorType.AuthenticationError => "authentication_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaAuthenticationErrorType? ToEnum(string value) + { + return value switch + { + "authentication_error" => BetaAuthenticationErrorType.AuthenticationError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSource.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSource.Json.g.cs new file mode 100644 index 0000000..1f23067 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSource.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaBase64ImageSource + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaBase64ImageSource? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaBase64ImageSource), + jsonSerializerContext) as global::Anthropic.BetaBase64ImageSource; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaBase64ImageSource? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaBase64ImageSource), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaBase64ImageSource; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSource.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSource.g.cs similarity index 54% rename from src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSource.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSource.g.cs index 824aee5..79cb987 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSource.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSource.g.cs @@ -4,31 +4,31 @@ namespace Anthropic { /// - /// The source of an image block. + /// /// - public sealed partial class ImageBlockSource + public sealed partial class BetaBase64ImageSource { /// - /// The base64-encoded image data. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("data")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Data { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaBase64ImageSourceTypeJsonConverter))] + public global::Anthropic.BetaBase64ImageSourceType Type { get; set; } /// - /// The media type of the image. + /// /// [global::System.Text.Json.Serialization.JsonPropertyName("media_type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ImageBlockSourceMediaTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaBase64ImageSourceMediaTypeJsonConverter))] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.ImageBlockSourceMediaType MediaType { get; set; } + public required global::Anthropic.BetaBase64ImageSourceMediaType MediaType { get; set; } /// - /// The type of image source. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ImageBlockSourceTypeJsonConverter))] - public global::Anthropic.ImageBlockSourceType Type { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] Data { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -37,32 +37,26 @@ public sealed partial class ImageBlockSource public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The base64-encoded image data. - /// - /// - /// The media type of the image. - /// - /// - /// The type of image source. - /// + /// + /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ImageBlockSource( - string data, - global::Anthropic.ImageBlockSourceMediaType mediaType, - global::Anthropic.ImageBlockSourceType type) + public BetaBase64ImageSource( + global::Anthropic.BetaBase64ImageSourceMediaType mediaType, + byte[] data, + global::Anthropic.BetaBase64ImageSourceType type) { - this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); this.MediaType = mediaType; + this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ImageBlockSource() + public BetaBase64ImageSource() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSourceMediaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSourceMediaType.g.cs new file mode 100644 index 0000000..f2b2fc4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSourceMediaType.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaBase64ImageSourceMediaType + { + /// + /// + /// + ImageJpeg, + /// + /// + /// + ImagePng, + /// + /// + /// + ImageGif, + /// + /// + /// + ImageWebp, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaBase64ImageSourceMediaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaBase64ImageSourceMediaType value) + { + return value switch + { + BetaBase64ImageSourceMediaType.ImageJpeg => "image/jpeg", + BetaBase64ImageSourceMediaType.ImagePng => "image/png", + BetaBase64ImageSourceMediaType.ImageGif => "image/gif", + BetaBase64ImageSourceMediaType.ImageWebp => "image/webp", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaBase64ImageSourceMediaType? ToEnum(string value) + { + return value switch + { + "image/jpeg" => BetaBase64ImageSourceMediaType.ImageJpeg, + "image/png" => BetaBase64ImageSourceMediaType.ImagePng, + "image/gif" => BetaBase64ImageSourceMediaType.ImageGif, + "image/webp" => BetaBase64ImageSourceMediaType.ImageWebp, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSourceType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSourceType.g.cs new file mode 100644 index 0000000..fa19444 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64ImageSourceType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaBase64ImageSourceType + { + /// + /// + /// + Base64, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaBase64ImageSourceTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaBase64ImageSourceType value) + { + return value switch + { + BetaBase64ImageSourceType.Base64 => "base64", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaBase64ImageSourceType? ToEnum(string value) + { + return value switch + { + "base64" => BetaBase64ImageSourceType.Base64, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSource.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSource.Json.g.cs new file mode 100644 index 0000000..3df1b1b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSource.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaBase64PDFSource + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaBase64PDFSource? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaBase64PDFSource), + jsonSerializerContext) as global::Anthropic.BetaBase64PDFSource; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaBase64PDFSource? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaBase64PDFSource), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaBase64PDFSource; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSource.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSource.g.cs new file mode 100644 index 0000000..55b2ae0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSource.g.cs @@ -0,0 +1,62 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaBase64PDFSource + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaBase64PDFSourceTypeJsonConverter))] + public global::Anthropic.BetaBase64PDFSourceType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("media_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaBase64PDFSourceMediaTypeJsonConverter))] + public global::Anthropic.BetaBase64PDFSourceMediaType MediaType { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] Data { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaBase64PDFSource( + byte[] data, + global::Anthropic.BetaBase64PDFSourceType type, + global::Anthropic.BetaBase64PDFSourceMediaType mediaType) + { + this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + this.Type = type; + this.MediaType = mediaType; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaBase64PDFSource() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSourceMediaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSourceMediaType.g.cs new file mode 100644 index 0000000..917396e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSourceMediaType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaBase64PDFSourceMediaType + { + /// + /// + /// + ApplicationPdf, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaBase64PDFSourceMediaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaBase64PDFSourceMediaType value) + { + return value switch + { + BetaBase64PDFSourceMediaType.ApplicationPdf => "application/pdf", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaBase64PDFSourceMediaType? ToEnum(string value) + { + return value switch + { + "application/pdf" => BetaBase64PDFSourceMediaType.ApplicationPdf, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSourceType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSourceType.g.cs new file mode 100644 index 0000000..874b5b0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBase64PDFSourceType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaBase64PDFSourceType + { + /// + /// + /// + Base64, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaBase64PDFSourceTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaBase64PDFSourceType value) + { + return value switch + { + BetaBase64PDFSourceType.Base64 => "base64", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaBase64PDFSourceType? ToEnum(string value) + { + return value switch + { + "base64" => BetaBase64PDFSourceType.Base64, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022.Json.g.cs new file mode 100644 index 0000000..067028b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaBashTool20241022 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaBashTool20241022? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaBashTool20241022), + jsonSerializerContext) as global::Anthropic.BetaBashTool20241022; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaBashTool20241022? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaBashTool20241022), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaBashTool20241022; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022.g.cs new file mode 100644 index 0000000..3d9e660 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022.g.cs @@ -0,0 +1,65 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaBashTool20241022 + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaBashTool20241022TypeJsonConverter))] + public global::Anthropic.BetaBashTool20241022Type Type { get; set; } + + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaBashTool20241022NameJsonConverter))] + public global::Anthropic.BetaBashTool20241022Name Name { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaBashTool20241022( + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaBashTool20241022Type type, + global::Anthropic.BetaBashTool20241022Name name) + { + this.CacheControl = cacheControl; + this.Type = type; + this.Name = name; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaBashTool20241022() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..7fe7241 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaBashTool20241022CacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaBashTool20241022CacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaBashTool20241022CacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaBashTool20241022CacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaBashTool20241022CacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaBashTool20241022CacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaBashTool20241022CacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminator.g.cs new file mode 100644 index 0000000..9b67062 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaBashTool20241022CacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaBashTool20241022CacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaBashTool20241022CacheControlDiscriminator( + global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaBashTool20241022CacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..9820d3b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022CacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaBashTool20241022CacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaBashTool20241022CacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaBashTool20241022CacheControlDiscriminatorType value) + { + return value switch + { + BetaBashTool20241022CacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaBashTool20241022CacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaBashTool20241022CacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022Name.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022Name.g.cs new file mode 100644 index 0000000..0987f67 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022Name.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + ///
+ public enum BetaBashTool20241022Name + { + /// + /// + /// + Bash, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaBashTool20241022NameExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaBashTool20241022Name value) + { + return value switch + { + BetaBashTool20241022Name.Bash => "bash", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaBashTool20241022Name? ToEnum(string value) + { + return value switch + { + "bash" => BetaBashTool20241022Name.Bash, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022Type.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022Type.g.cs new file mode 100644 index 0000000..b72195e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaBashTool20241022Type.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaBashTool20241022Type + { + /// + /// + /// + Bash20241022, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaBashTool20241022TypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaBashTool20241022Type value) + { + return value switch + { + BetaBashTool20241022Type.Bash20241022 => "bash_20241022", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaBashTool20241022Type? ToEnum(string value) + { + return value switch + { + "bash_20241022" => BetaBashTool20241022Type.Bash20241022, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeral.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeral.Json.g.cs new file mode 100644 index 0000000..86e8549 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeral.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaCacheControlEphemeral + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaCacheControlEphemeral? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaCacheControlEphemeral), + jsonSerializerContext) as global::Anthropic.BetaCacheControlEphemeral; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaCacheControlEphemeral? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaCacheControlEphemeral), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCacheControlEphemeral; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeral.g.cs similarity index 62% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminator.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeral.g.cs index b37b133..3ebf2bf 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminator.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeral.g.cs @@ -6,14 +6,14 @@ namespace Anthropic /// /// /// - public sealed partial class BlockDiscriminator + public sealed partial class BetaCacheControlEphemeral { /// /// /// [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BlockDiscriminatorTypeJsonConverter))] - public global::Anthropic.BlockDiscriminatorType? Type { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaCacheControlEphemeralTypeJsonConverter))] + public global::Anthropic.BetaCacheControlEphemeralType Type { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -22,20 +22,20 @@ public sealed partial class BlockDiscriminator public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public BlockDiscriminator( - global::Anthropic.BlockDiscriminatorType? type) + public BetaCacheControlEphemeral( + global::Anthropic.BetaCacheControlEphemeralType type) { this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public BlockDiscriminator() + public BetaCacheControlEphemeral() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeralType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeralType.g.cs new file mode 100644 index 0000000..5f99e2c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCacheControlEphemeralType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaCacheControlEphemeralType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaCacheControlEphemeralTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaCacheControlEphemeralType value) + { + return value switch + { + BetaCacheControlEphemeralType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaCacheControlEphemeralType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaCacheControlEphemeralType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResult.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminator.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResult.Json.g.cs index ce2353e..628c93a 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminator.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResult.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class BlockDiscriminator + public sealed partial class BetaCanceledResult { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.BlockDiscriminator? FromJson( + public static global::Anthropic.BetaCanceledResult? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.BlockDiscriminator), - jsonSerializerContext) as global::Anthropic.BlockDiscriminator; + typeof(global::Anthropic.BetaCanceledResult), + jsonSerializerContext) as global::Anthropic.BetaCanceledResult; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.BlockDiscriminator? FromJson( + public static global::Anthropic.BetaCanceledResult? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.BlockDiscriminator), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BlockDiscriminator; + typeof(global::Anthropic.BetaCanceledResult), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCanceledResult; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResult.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResult.g.cs new file mode 100644 index 0000000..3478f9d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResult.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaCanceledResult + { + /// + /// Default Value: canceled + /// + /// global::Anthropic.BetaCanceledResultType.Canceled + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaCanceledResultTypeJsonConverter))] + public global::Anthropic.BetaCanceledResultType Type { get; set; } = global::Anthropic.BetaCanceledResultType.Canceled; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: canceled + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaCanceledResult( + global::Anthropic.BetaCanceledResultType type = global::Anthropic.BetaCanceledResultType.Canceled) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaCanceledResult() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResultType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResultType.g.cs new file mode 100644 index 0000000..a5506d9 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCanceledResultType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: canceled + /// + public enum BetaCanceledResultType + { + /// + /// + /// + Canceled, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaCanceledResultTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaCanceledResultType value) + { + return value switch + { + BetaCanceledResultType.Canceled => "canceled", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaCanceledResultType? ToEnum(string value) + { + return value switch + { + "canceled" => BetaCanceledResultType.Canceled, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022.Json.g.cs new file mode 100644 index 0000000..ca251e1 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaComputerUseTool20241022 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaComputerUseTool20241022? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaComputerUseTool20241022), + jsonSerializerContext) as global::Anthropic.BetaComputerUseTool20241022; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaComputerUseTool20241022? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaComputerUseTool20241022), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaComputerUseTool20241022; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolComputerUse.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022.g.cs similarity index 61% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolComputerUse.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022.g.cs index 2ac56a1..b8c7291 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolComputerUse.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022.g.cs @@ -4,29 +4,37 @@ namespace Anthropic { /// - /// A tool that uses a mouse and keyboard to interact with a computer, and take screenshots. + /// /// - public sealed partial class ToolComputerUse + public sealed partial class BetaComputerUseTool20241022 { /// - /// The type of tool.
- /// Default Value: computer_20241022 + /// + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// /// [global::System.Text.Json.Serialization.JsonPropertyName("type")] - public string? Type { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022TypeJsonConverter))] + public global::Anthropic.BetaComputerUseTool20241022Type Type { get; set; } /// - /// The name of the tool.
- /// Default Value: computer + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. ///
[global::System.Text.Json.Serialization.JsonPropertyName("name")] - public string? Name { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022NameJsonConverter))] + public global::Anthropic.BetaComputerUseTool20241022Name Name { get; set; } /// - /// The cache control settings. + /// The height of the display in pixels. /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] - public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("display_height_px")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int DisplayHeightPx { get; set; } /// /// The width of the display in pixels. @@ -36,14 +44,7 @@ public sealed partial class ToolComputerUse public required int DisplayWidthPx { get; set; } /// - /// The height of the display in pixels. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("display_height_px")] - [global::System.Text.Json.Serialization.JsonRequired] - public required int DisplayHeightPx { get; set; } - - /// - /// The number of the display to use. + /// The X11 display number (e.g. 0, 1) for the display. /// [global::System.Text.Json.Serialization.JsonPropertyName("display_number")] public int? DisplayNumber { get; set; } @@ -55,49 +56,44 @@ public sealed partial class ToolComputerUse public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The type of tool.
- /// Default Value: computer_20241022 - /// + /// + /// /// - /// The name of the tool.
- /// Default Value: computer + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. /// - /// - /// The cache control settings. + /// + /// The height of the display in pixels. /// /// /// The width of the display in pixels. /// - /// - /// The height of the display in pixels. - /// /// - /// The number of the display to use. + /// The X11 display number (e.g. 0, 1) for the display. /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolComputerUse( - int displayWidthPx, + public BetaComputerUseTool20241022( int displayHeightPx, - string? type, - string? name, - global::Anthropic.CacheControlEphemeral? cacheControl, + int displayWidthPx, + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaComputerUseTool20241022Type type, + global::Anthropic.BetaComputerUseTool20241022Name name, int? displayNumber) { - this.DisplayWidthPx = displayWidthPx; this.DisplayHeightPx = displayHeightPx; + this.DisplayWidthPx = displayWidthPx; + this.CacheControl = cacheControl; this.Type = type; this.Name = name; - this.CacheControl = cacheControl; this.DisplayNumber = displayNumber; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ToolComputerUse() + public BetaComputerUseTool20241022() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..59c6a24 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaComputerUseTool20241022CacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminator.g.cs new file mode 100644 index 0000000..39ae0b8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaComputerUseTool20241022CacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaComputerUseTool20241022CacheControlDiscriminator( + global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaComputerUseTool20241022CacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..5ffd816 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022CacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaComputerUseTool20241022CacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaComputerUseTool20241022CacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaComputerUseTool20241022CacheControlDiscriminatorType value) + { + return value switch + { + BetaComputerUseTool20241022CacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaComputerUseTool20241022CacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaComputerUseTool20241022CacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022Name.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022Name.g.cs new file mode 100644 index 0000000..3683626 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022Name.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + ///
+ public enum BetaComputerUseTool20241022Name + { + /// + /// + /// + Computer, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaComputerUseTool20241022NameExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaComputerUseTool20241022Name value) + { + return value switch + { + BetaComputerUseTool20241022Name.Computer => "computer", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaComputerUseTool20241022Name? ToEnum(string value) + { + return value switch + { + "computer" => BetaComputerUseTool20241022Name.Computer, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022Type.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022Type.g.cs new file mode 100644 index 0000000..bcca885 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaComputerUseTool20241022Type.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaComputerUseTool20241022Type + { + /// + /// + /// + Computer20241022, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaComputerUseTool20241022TypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaComputerUseTool20241022Type value) + { + return value switch + { + BetaComputerUseTool20241022Type.Computer20241022 => "computer_20241022", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaComputerUseTool20241022Type? ToEnum(string value) + { + return value switch + { + "computer_20241022" => BetaComputerUseTool20241022Type.Computer20241022, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlock.Json.g.cs new file mode 100644 index 0000000..3ca77b4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct BetaContentBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaContentBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaContentBlock), + jsonSerializerContext) as global::Anthropic.BetaContentBlock?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaContentBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaContentBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaContentBlock?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlock.g.cs new file mode 100644 index 0000000..7e06695 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlock.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct BetaContentBlock : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaContentBlockDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaResponseTextBlock? Text { get; init; } +#else + public global::Anthropic.BetaResponseTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator BetaContentBlock(global::Anthropic.BetaResponseTextBlock value) => new BetaContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaResponseTextBlock?(BetaContentBlock @this) => @this.Text; + + /// + /// + /// + public BetaContentBlock(global::Anthropic.BetaResponseTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaResponseToolUseBlock? ToolUse { get; init; } +#else + public global::Anthropic.BetaResponseToolUseBlock? ToolUse { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolUse))] +#endif + public bool IsToolUse => ToolUse != null; + + /// + /// + /// + public static implicit operator BetaContentBlock(global::Anthropic.BetaResponseToolUseBlock value) => new BetaContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaResponseToolUseBlock?(BetaContentBlock @this) => @this.ToolUse; + + /// + /// + /// + public BetaContentBlock(global::Anthropic.BetaResponseToolUseBlock? value) + { + ToolUse = value; + } + + /// + /// + /// + public BetaContentBlock( + global::Anthropic.BetaContentBlockDiscriminatorType? type, + global::Anthropic.BetaResponseTextBlock? text, + global::Anthropic.BetaResponseToolUseBlock? toolUse + ) + { + Type = type; + + Text = text; + ToolUse = toolUse; + } + + /// + /// + /// + public object? Object => + ToolUse as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsToolUse || !IsText && IsToolUse; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsToolUse && toolUse != null) + { + return toolUse(ToolUse!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsToolUse) + { + toolUse?.Invoke(ToolUse!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.BetaResponseTextBlock), + ToolUse, + typeof(global::Anthropic.BetaResponseToolUseBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(BetaContentBlock other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) + ; + } + + /// + /// + /// + public static bool operator ==(BetaContentBlock obj1, BetaContentBlock obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(BetaContentBlock obj1, BetaContentBlock obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is BetaContentBlock o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEvent.Json.g.cs new file mode 100644 index 0000000..c313063 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaContentBlockDeltaEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaContentBlockDeltaEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaContentBlockDeltaEvent), + jsonSerializerContext) as global::Anthropic.BetaContentBlockDeltaEvent; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaContentBlockDeltaEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaContentBlockDeltaEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaContentBlockDeltaEvent; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEvent.g.cs new file mode 100644 index 0000000..3ca6a44 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEvent.g.cs @@ -0,0 +1,66 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaContentBlockDeltaEvent + { + /// + /// Default Value: content_block_delta + /// + /// global::Anthropic.BetaContentBlockDeltaEventType.ContentBlockDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaContentBlockDeltaEventTypeJsonConverter))] + public global::Anthropic.BetaContentBlockDeltaEventType Type { get; set; } = global::Anthropic.BetaContentBlockDeltaEventType.ContentBlockDelta; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("index")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Index { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("delta")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.DeltaJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Delta Delta { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: content_block_delta + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaContentBlockDeltaEvent( + int index, + global::Anthropic.Delta delta, + global::Anthropic.BetaContentBlockDeltaEventType type = global::Anthropic.BetaContentBlockDeltaEventType.ContentBlockDelta) + { + this.Index = index; + this.Delta = delta; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaContentBlockDeltaEvent() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminator.Json.g.cs new file mode 100644 index 0000000..70fa679 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaContentBlockDeltaEventDeltaDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminator.g.cs new file mode 100644 index 0000000..77d308d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaContentBlockDeltaEventDeltaDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaContentBlockDeltaEventDeltaDiscriminator( + global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaContentBlockDeltaEventDeltaDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminatorType.g.cs new file mode 100644 index 0000000..188d26a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventDeltaDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaContentBlockDeltaEventDeltaDiscriminatorType + { + /// + /// + /// + InputJsonDelta, + /// + /// + /// + TextDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaContentBlockDeltaEventDeltaDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaContentBlockDeltaEventDeltaDiscriminatorType value) + { + return value switch + { + BetaContentBlockDeltaEventDeltaDiscriminatorType.InputJsonDelta => "input_json_delta", + BetaContentBlockDeltaEventDeltaDiscriminatorType.TextDelta => "text_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaContentBlockDeltaEventDeltaDiscriminatorType? ToEnum(string value) + { + return value switch + { + "input_json_delta" => BetaContentBlockDeltaEventDeltaDiscriminatorType.InputJsonDelta, + "text_delta" => BetaContentBlockDeltaEventDeltaDiscriminatorType.TextDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventType.g.cs new file mode 100644 index 0000000..ce4dbb9 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDeltaEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: content_block_delta + /// + public enum BetaContentBlockDeltaEventType + { + /// + /// + /// + ContentBlockDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaContentBlockDeltaEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaContentBlockDeltaEventType value) + { + return value switch + { + BetaContentBlockDeltaEventType.ContentBlockDelta => "content_block_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaContentBlockDeltaEventType? ToEnum(string value) + { + return value switch + { + "content_block_delta" => BetaContentBlockDeltaEventType.ContentBlockDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminator.Json.g.cs new file mode 100644 index 0000000..25f6b44 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaContentBlockDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaContentBlockDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaContentBlockDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminator.g.cs new file mode 100644 index 0000000..4d933c1 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaContentBlockDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaContentBlockDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaContentBlockDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaContentBlockDiscriminator( + global::Anthropic.BetaContentBlockDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaContentBlockDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminatorType.g.cs similarity index 56% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminatorType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminatorType.g.cs index 55c6a1f..355492b 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminatorType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockDiscriminatorType.g.cs @@ -6,44 +6,44 @@ namespace Anthropic /// /// /// - public enum BlockDeltaDiscriminatorType + public enum BetaContentBlockDiscriminatorType { /// /// /// - TextDelta, + Text, /// /// /// - InputJsonDelta, + ToolUse, } /// /// Enum extensions to do fast conversions without the reflection. /// - public static class BlockDeltaDiscriminatorTypeExtensions + public static class BetaContentBlockDiscriminatorTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this BlockDeltaDiscriminatorType value) + public static string ToValueString(this BetaContentBlockDiscriminatorType value) { return value switch { - BlockDeltaDiscriminatorType.TextDelta => "text_delta", - BlockDeltaDiscriminatorType.InputJsonDelta => "input_json_delta", + BetaContentBlockDiscriminatorType.Text => "text", + BetaContentBlockDiscriminatorType.ToolUse => "tool_use", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static BlockDeltaDiscriminatorType? ToEnum(string value) + public static BetaContentBlockDiscriminatorType? ToEnum(string value) { return value switch { - "text_delta" => BlockDeltaDiscriminatorType.TextDelta, - "input_json_delta" => BlockDeltaDiscriminatorType.InputJsonDelta, + "text" => BetaContentBlockDiscriminatorType.Text, + "tool_use" => BetaContentBlockDiscriminatorType.ToolUse, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEvent.Json.g.cs new file mode 100644 index 0000000..18cb7fb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaContentBlockStartEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaContentBlockStartEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaContentBlockStartEvent), + jsonSerializerContext) as global::Anthropic.BetaContentBlockStartEvent; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaContentBlockStartEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaContentBlockStartEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaContentBlockStartEvent; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEvent.g.cs new file mode 100644 index 0000000..aaafce0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEvent.g.cs @@ -0,0 +1,66 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaContentBlockStartEvent + { + /// + /// Default Value: content_block_start + /// + /// global::Anthropic.BetaContentBlockStartEventType.ContentBlockStart + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaContentBlockStartEventTypeJsonConverter))] + public global::Anthropic.BetaContentBlockStartEventType Type { get; set; } = global::Anthropic.BetaContentBlockStartEventType.ContentBlockStart; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("index")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Index { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content_block")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlockJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.ContentBlock ContentBlock { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: content_block_start + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaContentBlockStartEvent( + int index, + global::Anthropic.ContentBlock contentBlock, + global::Anthropic.BetaContentBlockStartEventType type = global::Anthropic.BetaContentBlockStartEventType.ContentBlockStart) + { + this.Index = index; + this.ContentBlock = contentBlock; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaContentBlockStartEvent() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminator.Json.g.cs new file mode 100644 index 0000000..e0c073a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaContentBlockStartEventContentBlockDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminator.g.cs new file mode 100644 index 0000000..34466c8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaContentBlockStartEventContentBlockDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaContentBlockStartEventContentBlockDiscriminator( + global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaContentBlockStartEventContentBlockDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..95dc965 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventContentBlockDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaContentBlockStartEventContentBlockDiscriminatorType + { + /// + /// + /// + Text, + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaContentBlockStartEventContentBlockDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaContentBlockStartEventContentBlockDiscriminatorType value) + { + return value switch + { + BetaContentBlockStartEventContentBlockDiscriminatorType.Text => "text", + BetaContentBlockStartEventContentBlockDiscriminatorType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaContentBlockStartEventContentBlockDiscriminatorType? ToEnum(string value) + { + return value switch + { + "text" => BetaContentBlockStartEventContentBlockDiscriminatorType.Text, + "tool_use" => BetaContentBlockStartEventContentBlockDiscriminatorType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventType.g.cs new file mode 100644 index 0000000..ad113ee --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStartEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: content_block_start + /// + public enum BetaContentBlockStartEventType + { + /// + /// + /// + ContentBlockStart, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaContentBlockStartEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaContentBlockStartEventType value) + { + return value switch + { + BetaContentBlockStartEventType.ContentBlockStart => "content_block_start", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaContentBlockStartEventType? ToEnum(string value) + { + return value switch + { + "content_block_start" => BetaContentBlockStartEventType.ContentBlockStart, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageBatchRequest.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEvent.Json.g.cs similarity index 86% rename from src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageBatchRequest.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEvent.Json.g.cs index 2b8c680..513f51c 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageBatchRequest.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEvent.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class CreateMessageBatchRequest + public sealed partial class BetaContentBlockStopEvent { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.CreateMessageBatchRequest? FromJson( + public static global::Anthropic.BetaContentBlockStopEvent? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.CreateMessageBatchRequest), - jsonSerializerContext) as global::Anthropic.CreateMessageBatchRequest; + typeof(global::Anthropic.BetaContentBlockStopEvent), + jsonSerializerContext) as global::Anthropic.BetaContentBlockStopEvent; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.CreateMessageBatchRequest? FromJson( + public static global::Anthropic.BetaContentBlockStopEvent? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.CreateMessageBatchRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.CreateMessageBatchRequest; + typeof(global::Anthropic.BetaContentBlockStopEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaContentBlockStopEvent; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEvent.g.cs new file mode 100644 index 0000000..bb6c8e4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEvent.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaContentBlockStopEvent + { + /// + /// Default Value: content_block_stop + /// + /// global::Anthropic.BetaContentBlockStopEventType.ContentBlockStop + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaContentBlockStopEventTypeJsonConverter))] + public global::Anthropic.BetaContentBlockStopEventType Type { get; set; } = global::Anthropic.BetaContentBlockStopEventType.ContentBlockStop; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("index")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Index { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: content_block_stop + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaContentBlockStopEvent( + int index, + global::Anthropic.BetaContentBlockStopEventType type = global::Anthropic.BetaContentBlockStopEventType.ContentBlockStop) + { + this.Index = index; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaContentBlockStopEvent() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEventType.g.cs new file mode 100644 index 0000000..642454b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaContentBlockStopEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: content_block_stop + /// + public enum BetaContentBlockStopEventType + { + /// + /// + /// + ContentBlockStop, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaContentBlockStopEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaContentBlockStopEventType value) + { + return value switch + { + BetaContentBlockStopEventType.ContentBlockStop => "content_block_stop", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaContentBlockStopEventType? ToEnum(string value) + { + return value switch + { + "content_block_stop" => BetaContentBlockStopEventType.ContentBlockStop, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParams.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParams.Json.g.cs new file mode 100644 index 0000000..d5441d7 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParams.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaCountMessageTokensParams + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaCountMessageTokensParams? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaCountMessageTokensParams), + jsonSerializerContext) as global::Anthropic.BetaCountMessageTokensParams; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaCountMessageTokensParams? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaCountMessageTokensParams), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCountMessageTokensParams; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParams.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParams.g.cs new file mode 100644 index 0000000..3d1bab6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParams.g.cs @@ -0,0 +1,285 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaCountMessageTokensParams + { + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolChoiceJsonConverter))] + public global::Anthropic.BetaToolChoice? ToolChoice { get; set; } + + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("tools")] + public global::System.Collections.Generic.IList? Tools { get; set; } + + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("messages")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Messages { get; set; } + + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + ///
+ /// [] + [global::System.Text.Json.Serialization.JsonPropertyName("system")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? System { get; set; } + + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaCountMessageTokensParams( + global::System.Collections.Generic.IList messages, + global::Anthropic.Model model, + global::Anthropic.BetaToolChoice? toolChoice, + global::System.Collections.Generic.IList? tools, + global::Anthropic.AnyOf>? system) + { + this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages)); + this.Model = model; + this.ToolChoice = toolChoice; + this.Tools = tools; + this.System = system; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaCountMessageTokensParams() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminator.Json.g.cs new file mode 100644 index 0000000..4a70574 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaCountMessageTokensParamsToolDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminator.g.cs new file mode 100644 index 0000000..e4c2083 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaCountMessageTokensParamsToolDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaCountMessageTokensParamsToolDiscriminator( + global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaCountMessageTokensParamsToolDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminatorType.g.cs new file mode 100644 index 0000000..54660e6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensParamsToolDiscriminatorType.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaCountMessageTokensParamsToolDiscriminatorType + { + /// + /// + /// + Custom, + /// + /// + /// + Computer20241022, + /// + /// + /// + Bash20241022, + /// + /// + /// + TextEditor20241022, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaCountMessageTokensParamsToolDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaCountMessageTokensParamsToolDiscriminatorType value) + { + return value switch + { + BetaCountMessageTokensParamsToolDiscriminatorType.Custom => "custom", + BetaCountMessageTokensParamsToolDiscriminatorType.Computer20241022 => "computer_20241022", + BetaCountMessageTokensParamsToolDiscriminatorType.Bash20241022 => "bash_20241022", + BetaCountMessageTokensParamsToolDiscriminatorType.TextEditor20241022 => "text_editor_20241022", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaCountMessageTokensParamsToolDiscriminatorType? ToEnum(string value) + { + return value switch + { + "custom" => BetaCountMessageTokensParamsToolDiscriminatorType.Custom, + "computer_20241022" => BetaCountMessageTokensParamsToolDiscriminatorType.Computer20241022, + "bash_20241022" => BetaCountMessageTokensParamsToolDiscriminatorType.Bash20241022, + "text_editor_20241022" => BetaCountMessageTokensParamsToolDiscriminatorType.TextEditor20241022, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensResponse.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensResponse.Json.g.cs new file mode 100644 index 0000000..9adf298 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaCountMessageTokensResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaCountMessageTokensResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaCountMessageTokensResponse), + jsonSerializerContext) as global::Anthropic.BetaCountMessageTokensResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaCountMessageTokensResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaCountMessageTokensResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCountMessageTokensResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensResponse.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensResponse.g.cs new file mode 100644 index 0000000..20cfc54 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCountMessageTokensResponse.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaCountMessageTokensResponse + { + /// + /// The total number of tokens across the provided list of messages, system prompt, and tools.
+ /// Example: 2095 + ///
+ /// 2095 + [global::System.Text.Json.Serialization.JsonPropertyName("input_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int InputTokens { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The total number of tokens across the provided list of messages, system prompt, and tools.
+ /// Example: 2095 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaCountMessageTokensResponse( + int inputTokens) + { + this.InputTokens = inputTokens; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaCountMessageTokensResponse() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageBatchParams.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageBatchParams.Json.g.cs new file mode 100644 index 0000000..d19e59d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageBatchParams.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaCreateMessageBatchParams + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaCreateMessageBatchParams? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaCreateMessageBatchParams), + jsonSerializerContext) as global::Anthropic.BetaCreateMessageBatchParams; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaCreateMessageBatchParams? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaCreateMessageBatchParams), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCreateMessageBatchParams; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageBatchRequest.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageBatchParams.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageBatchRequest.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageBatchParams.g.cs index 47ac284..a0d074c 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageBatchRequest.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageBatchParams.g.cs @@ -4,16 +4,16 @@ namespace Anthropic { /// - /// The request parameters for creating a message batch. + /// /// - public sealed partial class CreateMessageBatchRequest + public sealed partial class BetaCreateMessageBatchParams { /// /// List of requests for prompt completion. Each is an individual request to create a Message. /// [global::System.Text.Json.Serialization.JsonPropertyName("requests")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::System.Collections.Generic.IList Requests { get; set; } + public required global::System.Collections.Generic.IList Requests { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -22,22 +22,22 @@ public sealed partial class CreateMessageBatchRequest public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// List of requests for prompt completion. Each is an individual request to create a Message. /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public CreateMessageBatchRequest( - global::System.Collections.Generic.IList requests) + public BetaCreateMessageBatchParams( + global::System.Collections.Generic.IList requests) { this.Requests = requests ?? throw new global::System.ArgumentNullException(nameof(requests)); } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public CreateMessageBatchRequest() + public BetaCreateMessageBatchParams() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParams.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParams.Json.g.cs new file mode 100644 index 0000000..643412d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParams.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaCreateMessageParams + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaCreateMessageParams? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaCreateMessageParams), + jsonSerializerContext) as global::Anthropic.BetaCreateMessageParams; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaCreateMessageParams? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaCreateMessageParams), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCreateMessageParams; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParams.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParams.g.cs new file mode 100644 index 0000000..73a8482 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParams.g.cs @@ -0,0 +1,397 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaCreateMessageParams + { + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("messages")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Messages { get; set; } + + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + ///
+ /// 1024 + [global::System.Text.Json.Serialization.JsonPropertyName("max_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int MaxTokens { get; set; } + + /// + /// An object describing metadata about the request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("metadata")] + public global::Anthropic.BetaMetadata? Metadata { get; set; } + + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_sequences")] + public global::System.Collections.Generic.IList? StopSequences { get; set; } + + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stream")] + public bool? Stream { get; set; } + + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + ///
+ /// [] + [global::System.Text.Json.Serialization.JsonPropertyName("system")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? System { get; set; } + + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + ///
+ /// 1 + [global::System.Text.Json.Serialization.JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolChoiceJsonConverter))] + public global::Anthropic.BetaToolChoice? ToolChoice { get; set; } + + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("tools")] + public global::System.Collections.Generic.IList? Tools { get; set; } + + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + ///
+ /// 5 + [global::System.Text.Json.Serialization.JsonPropertyName("top_k")] + public int? TopK { get; set; } + + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + ///
+ /// 0.7 + [global::System.Text.Json.Serialization.JsonPropertyName("top_p")] + public double? TopP { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaCreateMessageParams( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + global::Anthropic.BetaMetadata? metadata, + global::System.Collections.Generic.IList? stopSequences, + bool? stream, + global::Anthropic.AnyOf>? system, + double? temperature, + global::Anthropic.BetaToolChoice? toolChoice, + global::System.Collections.Generic.IList? tools, + int? topK, + double? topP) + { + this.Model = model; + this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages)); + this.MaxTokens = maxTokens; + this.Metadata = metadata; + this.StopSequences = stopSequences; + this.Stream = stream; + this.System = system; + this.Temperature = temperature; + this.ToolChoice = toolChoice; + this.Tools = tools; + this.TopK = topK; + this.TopP = topP; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaCreateMessageParams() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminator.Json.g.cs new file mode 100644 index 0000000..9a06526 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaCreateMessageParamsToolDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaCreateMessageParamsToolDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaCreateMessageParamsToolDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaCreateMessageParamsToolDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaCreateMessageParamsToolDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaCreateMessageParamsToolDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaCreateMessageParamsToolDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminator.g.cs new file mode 100644 index 0000000..2110ebd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaCreateMessageParamsToolDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaCreateMessageParamsToolDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaCreateMessageParamsToolDiscriminator( + global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaCreateMessageParamsToolDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminatorType.g.cs new file mode 100644 index 0000000..399f7e6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaCreateMessageParamsToolDiscriminatorType.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaCreateMessageParamsToolDiscriminatorType + { + /// + /// + /// + Custom, + /// + /// + /// + Computer20241022, + /// + /// + /// + Bash20241022, + /// + /// + /// + TextEditor20241022, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaCreateMessageParamsToolDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaCreateMessageParamsToolDiscriminatorType value) + { + return value switch + { + BetaCreateMessageParamsToolDiscriminatorType.Custom => "custom", + BetaCreateMessageParamsToolDiscriminatorType.Computer20241022 => "computer_20241022", + BetaCreateMessageParamsToolDiscriminatorType.Bash20241022 => "bash_20241022", + BetaCreateMessageParamsToolDiscriminatorType.TextEditor20241022 => "text_editor_20241022", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaCreateMessageParamsToolDiscriminatorType? ToEnum(string value) + { + return value switch + { + "custom" => BetaCreateMessageParamsToolDiscriminatorType.Custom, + "computer_20241022" => BetaCreateMessageParamsToolDiscriminatorType.Computer20241022, + "bash_20241022" => BetaCreateMessageParamsToolDiscriminatorType.Bash20241022, + "text_editor_20241022" => BetaCreateMessageParamsToolDiscriminatorType.TextEditor20241022, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockInput.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponse.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockInput.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponse.Json.g.cs index 7489b1e..296aca8 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockInput.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponse.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolUseBlockInput + public sealed partial class BetaErrorResponse { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolUseBlockInput? FromJson( + public static global::Anthropic.BetaErrorResponse? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolUseBlockInput), - jsonSerializerContext) as global::Anthropic.ToolUseBlockInput; + typeof(global::Anthropic.BetaErrorResponse), + jsonSerializerContext) as global::Anthropic.BetaErrorResponse; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolUseBlockInput? FromJson( + public static global::Anthropic.BetaErrorResponse? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolUseBlockInput), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolUseBlockInput; + typeof(global::Anthropic.BetaErrorResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaErrorResponse; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponse.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponse.g.cs new file mode 100644 index 0000000..480b764 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponse.g.cs @@ -0,0 +1,56 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaErrorResponse + { + /// + /// Default Value: error + /// + /// global::Anthropic.BetaErrorResponseType.Error + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaErrorResponseTypeJsonConverter))] + public global::Anthropic.BetaErrorResponseType Type { get; set; } = global::Anthropic.BetaErrorResponseType.Error; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("error")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ErrorJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Error Error { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: error + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaErrorResponse( + global::Anthropic.Error error, + global::Anthropic.BetaErrorResponseType type = global::Anthropic.BetaErrorResponseType.Error) + { + this.Error = error; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaErrorResponse() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminator.Json.g.cs new file mode 100644 index 0000000..019db8b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaErrorResponseErrorDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaErrorResponseErrorDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaErrorResponseErrorDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaErrorResponseErrorDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaErrorResponseErrorDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaErrorResponseErrorDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaErrorResponseErrorDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminator.g.cs new file mode 100644 index 0000000..3daee28 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaErrorResponseErrorDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaErrorResponseErrorDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaErrorResponseErrorDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaErrorResponseErrorDiscriminator( + global::Anthropic.BetaErrorResponseErrorDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaErrorResponseErrorDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminatorType.g.cs new file mode 100644 index 0000000..b2e5307 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseErrorDiscriminatorType.g.cs @@ -0,0 +1,81 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaErrorResponseErrorDiscriminatorType + { + /// + /// + /// + ApiError, + /// + /// + /// + AuthenticationError, + /// + /// + /// + InvalidRequestError, + /// + /// + /// + NotFoundError, + /// + /// + /// + OverloadedError, + /// + /// + /// + PermissionError, + /// + /// + /// + RateLimitError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaErrorResponseErrorDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaErrorResponseErrorDiscriminatorType value) + { + return value switch + { + BetaErrorResponseErrorDiscriminatorType.ApiError => "api_error", + BetaErrorResponseErrorDiscriminatorType.AuthenticationError => "authentication_error", + BetaErrorResponseErrorDiscriminatorType.InvalidRequestError => "invalid_request_error", + BetaErrorResponseErrorDiscriminatorType.NotFoundError => "not_found_error", + BetaErrorResponseErrorDiscriminatorType.OverloadedError => "overloaded_error", + BetaErrorResponseErrorDiscriminatorType.PermissionError => "permission_error", + BetaErrorResponseErrorDiscriminatorType.RateLimitError => "rate_limit_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaErrorResponseErrorDiscriminatorType? ToEnum(string value) + { + return value switch + { + "api_error" => BetaErrorResponseErrorDiscriminatorType.ApiError, + "authentication_error" => BetaErrorResponseErrorDiscriminatorType.AuthenticationError, + "invalid_request_error" => BetaErrorResponseErrorDiscriminatorType.InvalidRequestError, + "not_found_error" => BetaErrorResponseErrorDiscriminatorType.NotFoundError, + "overloaded_error" => BetaErrorResponseErrorDiscriminatorType.OverloadedError, + "permission_error" => BetaErrorResponseErrorDiscriminatorType.PermissionError, + "rate_limit_error" => BetaErrorResponseErrorDiscriminatorType.RateLimitError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseType.g.cs new file mode 100644 index 0000000..56b82df --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErrorResponseType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: error + /// + public enum BetaErrorResponseType + { + /// + /// + /// + Error, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaErrorResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaErrorResponseType value) + { + return value switch + { + BetaErrorResponseType.Error => "error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaErrorResponseType? ToEnum(string value) + { + return value switch + { + "error" => BetaErrorResponseType.Error, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResult.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResult.Json.g.cs new file mode 100644 index 0000000..b8e65a9 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResult.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaErroredResult + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaErroredResult? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaErroredResult), + jsonSerializerContext) as global::Anthropic.BetaErroredResult; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaErroredResult? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaErroredResult), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaErroredResult; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResult.g.cs similarity index 56% rename from src/libs/Anthropic/Generated/Anthropic.Models.ErrorEvent.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResult.g.cs index 59810c6..eca011a 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResult.g.cs @@ -4,24 +4,24 @@ namespace Anthropic { /// - /// An error event in a streaming conversation. + /// /// - public sealed partial class ErrorEvent + public sealed partial class BetaErroredResult { /// - /// The type of a streaming event. + /// Default Value: errored /// + /// global::Anthropic.BetaErroredResultType.Errored [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaErroredResultTypeJsonConverter))] + public global::Anthropic.BetaErroredResultType Type { get; set; } = global::Anthropic.BetaErroredResultType.Errored; /// - /// An error object. + /// /// [global::System.Text.Json.Serialization.JsonPropertyName("error")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.Error Error { get; set; } + public required global::Anthropic.BetaErrorResponse Error { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -30,27 +30,25 @@ public sealed partial class ErrorEvent public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// The type of a streaming event. - /// - /// - /// An error object. + /// Default Value: errored /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ErrorEvent( - global::Anthropic.MessageStreamEventType type, - global::Anthropic.Error error) + public BetaErroredResult( + global::Anthropic.BetaErrorResponse error, + global::Anthropic.BetaErroredResultType type = global::Anthropic.BetaErroredResultType.Errored) { - this.Type = type; this.Error = error ?? throw new global::System.ArgumentNullException(nameof(error)); + this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ErrorEvent() + public BetaErroredResult() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResultType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResultType.g.cs new file mode 100644 index 0000000..91469ef --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaErroredResultType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: errored + /// + public enum BetaErroredResultType + { + /// + /// + /// + Errored, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaErroredResultTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaErroredResultType value) + { + return value switch + { + BetaErroredResultType.Errored => "errored", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaErroredResultType? ToEnum(string value) + { + return value switch + { + "errored" => BetaErroredResultType.Errored, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResult.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResult.Json.g.cs new file mode 100644 index 0000000..76850ca --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResult.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaExpiredResult + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaExpiredResult? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaExpiredResult), + jsonSerializerContext) as global::Anthropic.BetaExpiredResult; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaExpiredResult? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaExpiredResult), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaExpiredResult; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResult.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResult.g.cs new file mode 100644 index 0000000..a367f38 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResult.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaExpiredResult + { + /// + /// Default Value: expired + /// + /// global::Anthropic.BetaExpiredResultType.Expired + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaExpiredResultTypeJsonConverter))] + public global::Anthropic.BetaExpiredResultType Type { get; set; } = global::Anthropic.BetaExpiredResultType.Expired; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: expired + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaExpiredResult( + global::Anthropic.BetaExpiredResultType type = global::Anthropic.BetaExpiredResultType.Expired) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaExpiredResult() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResultType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResultType.g.cs new file mode 100644 index 0000000..6e455a0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaExpiredResultType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: expired + /// + public enum BetaExpiredResultType + { + /// + /// + /// + Expired, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaExpiredResultTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaExpiredResultType value) + { + return value switch + { + BetaExpiredResultType.Expired => "expired", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaExpiredResultType? ToEnum(string value) + { + return value switch + { + "expired" => BetaExpiredResultType.Expired, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlock.Json.g.cs new file mode 100644 index 0000000..67a5ffd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct BetaInputContentBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaInputContentBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaInputContentBlock), + jsonSerializerContext) as global::Anthropic.BetaInputContentBlock?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaInputContentBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaInputContentBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaInputContentBlock?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlock.g.cs new file mode 100644 index 0000000..ce3087e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlock.g.cs @@ -0,0 +1,375 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct BetaInputContentBlock : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaInputContentBlockDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRequestTextBlock? Text { get; init; } +#else + public global::Anthropic.BetaRequestTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator BetaInputContentBlock(global::Anthropic.BetaRequestTextBlock value) => new BetaInputContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRequestTextBlock?(BetaInputContentBlock @this) => @this.Text; + + /// + /// + /// + public BetaInputContentBlock(global::Anthropic.BetaRequestTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRequestImageBlock? Image { get; init; } +#else + public global::Anthropic.BetaRequestImageBlock? Image { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Image))] +#endif + public bool IsImage => Image != null; + + /// + /// + /// + public static implicit operator BetaInputContentBlock(global::Anthropic.BetaRequestImageBlock value) => new BetaInputContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRequestImageBlock?(BetaInputContentBlock @this) => @this.Image; + + /// + /// + /// + public BetaInputContentBlock(global::Anthropic.BetaRequestImageBlock? value) + { + Image = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRequestToolUseBlock? ToolUse { get; init; } +#else + public global::Anthropic.BetaRequestToolUseBlock? ToolUse { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolUse))] +#endif + public bool IsToolUse => ToolUse != null; + + /// + /// + /// + public static implicit operator BetaInputContentBlock(global::Anthropic.BetaRequestToolUseBlock value) => new BetaInputContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRequestToolUseBlock?(BetaInputContentBlock @this) => @this.ToolUse; + + /// + /// + /// + public BetaInputContentBlock(global::Anthropic.BetaRequestToolUseBlock? value) + { + ToolUse = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRequestToolResultBlock? ToolResult { get; init; } +#else + public global::Anthropic.BetaRequestToolResultBlock? ToolResult { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolResult))] +#endif + public bool IsToolResult => ToolResult != null; + + /// + /// + /// + public static implicit operator BetaInputContentBlock(global::Anthropic.BetaRequestToolResultBlock value) => new BetaInputContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRequestToolResultBlock?(BetaInputContentBlock @this) => @this.ToolResult; + + /// + /// + /// + public BetaInputContentBlock(global::Anthropic.BetaRequestToolResultBlock? value) + { + ToolResult = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRequestPDFBlock? Document { get; init; } +#else + public global::Anthropic.BetaRequestPDFBlock? Document { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Document))] +#endif + public bool IsDocument => Document != null; + + /// + /// + /// + public static implicit operator BetaInputContentBlock(global::Anthropic.BetaRequestPDFBlock value) => new BetaInputContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRequestPDFBlock?(BetaInputContentBlock @this) => @this.Document; + + /// + /// + /// + public BetaInputContentBlock(global::Anthropic.BetaRequestPDFBlock? value) + { + Document = value; + } + + /// + /// + /// + public BetaInputContentBlock( + global::Anthropic.BetaInputContentBlockDiscriminatorType? type, + global::Anthropic.BetaRequestTextBlock? text, + global::Anthropic.BetaRequestImageBlock? image, + global::Anthropic.BetaRequestToolUseBlock? toolUse, + global::Anthropic.BetaRequestToolResultBlock? toolResult, + global::Anthropic.BetaRequestPDFBlock? document + ) + { + Type = type; + + Text = text; + Image = image; + ToolUse = toolUse; + ToolResult = toolResult; + Document = document; + } + + /// + /// + /// + public object? Object => + Document as object ?? + ToolResult as object ?? + ToolUse as object ?? + Image as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsImage && !IsToolUse && !IsToolResult && !IsDocument || !IsText && IsImage && !IsToolUse && !IsToolResult && !IsDocument || !IsText && !IsImage && IsToolUse && !IsToolResult && !IsDocument || !IsText && !IsImage && !IsToolUse && IsToolResult && !IsDocument || !IsText && !IsImage && !IsToolUse && !IsToolResult && IsDocument; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? image = null, + global::System.Func? toolUse = null, + global::System.Func? toolResult = null, + global::System.Func? document = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsImage && image != null) + { + return image(Image!); + } + else if (IsToolUse && toolUse != null) + { + return toolUse(ToolUse!); + } + else if (IsToolResult && toolResult != null) + { + return toolResult(ToolResult!); + } + else if (IsDocument && document != null) + { + return document(Document!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? image = null, + global::System.Action? toolUse = null, + global::System.Action? toolResult = null, + global::System.Action? document = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsImage) + { + image?.Invoke(Image!); + } + else if (IsToolUse) + { + toolUse?.Invoke(ToolUse!); + } + else if (IsToolResult) + { + toolResult?.Invoke(ToolResult!); + } + else if (IsDocument) + { + document?.Invoke(Document!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.BetaRequestTextBlock), + Image, + typeof(global::Anthropic.BetaRequestImageBlock), + ToolUse, + typeof(global::Anthropic.BetaRequestToolUseBlock), + ToolResult, + typeof(global::Anthropic.BetaRequestToolResultBlock), + Document, + typeof(global::Anthropic.BetaRequestPDFBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(BetaInputContentBlock other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Image, other.Image) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolResult, other.ToolResult) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Document, other.Document) + ; + } + + /// + /// + /// + public static bool operator ==(BetaInputContentBlock obj1, BetaInputContentBlock obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(BetaInputContentBlock obj1, BetaInputContentBlock obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is BetaInputContentBlock o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminator.Json.g.cs new file mode 100644 index 0000000..4733900 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaInputContentBlockDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaInputContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaInputContentBlockDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaInputContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaInputContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaInputContentBlockDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaInputContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminator.g.cs new file mode 100644 index 0000000..12e83f3 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaInputContentBlockDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaInputContentBlockDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaInputContentBlockDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaInputContentBlockDiscriminator( + global::Anthropic.BetaInputContentBlockDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaInputContentBlockDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..64c45be --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputContentBlockDiscriminatorType.g.cs @@ -0,0 +1,69 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaInputContentBlockDiscriminatorType + { + /// + /// + /// + Document, + /// + /// + /// + Image, + /// + /// + /// + Text, + /// + /// + /// + ToolResult, + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaInputContentBlockDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaInputContentBlockDiscriminatorType value) + { + return value switch + { + BetaInputContentBlockDiscriminatorType.Document => "document", + BetaInputContentBlockDiscriminatorType.Image => "image", + BetaInputContentBlockDiscriminatorType.Text => "text", + BetaInputContentBlockDiscriminatorType.ToolResult => "tool_result", + BetaInputContentBlockDiscriminatorType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaInputContentBlockDiscriminatorType? ToEnum(string value) + { + return value switch + { + "document" => BetaInputContentBlockDiscriminatorType.Document, + "image" => BetaInputContentBlockDiscriminatorType.Image, + "text" => BetaInputContentBlockDiscriminatorType.Text, + "tool_result" => BetaInputContentBlockDiscriminatorType.ToolResult, + "tool_use" => BetaInputContentBlockDiscriminatorType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDelta.Json.g.cs new file mode 100644 index 0000000..b5a804d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDelta.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaInputJsonContentBlockDelta + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaInputJsonContentBlockDelta? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaInputJsonContentBlockDelta), + jsonSerializerContext) as global::Anthropic.BetaInputJsonContentBlockDelta; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaInputJsonContentBlockDelta? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaInputJsonContentBlockDelta), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaInputJsonContentBlockDelta; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDelta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDelta.g.cs new file mode 100644 index 0000000..4588ac4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDelta.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaInputJsonContentBlockDelta + { + /// + /// Default Value: input_json_delta + /// + /// global::Anthropic.BetaInputJsonContentBlockDeltaType.InputJsonDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaInputJsonContentBlockDeltaTypeJsonConverter))] + public global::Anthropic.BetaInputJsonContentBlockDeltaType Type { get; set; } = global::Anthropic.BetaInputJsonContentBlockDeltaType.InputJsonDelta; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("partial_json")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string PartialJson { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: input_json_delta + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaInputJsonContentBlockDelta( + string partialJson, + global::Anthropic.BetaInputJsonContentBlockDeltaType type = global::Anthropic.BetaInputJsonContentBlockDeltaType.InputJsonDelta) + { + this.PartialJson = partialJson ?? throw new global::System.ArgumentNullException(nameof(partialJson)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaInputJsonContentBlockDelta() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDeltaType.g.cs new file mode 100644 index 0000000..8976ab3 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputJsonContentBlockDeltaType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: input_json_delta + /// + public enum BetaInputJsonContentBlockDeltaType + { + /// + /// + /// + InputJsonDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaInputJsonContentBlockDeltaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaInputJsonContentBlockDeltaType value) + { + return value switch + { + BetaInputJsonContentBlockDeltaType.InputJsonDelta => "input_json_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaInputJsonContentBlockDeltaType? ToEnum(string value) + { + return value switch + { + "input_json_delta" => BetaInputJsonContentBlockDeltaType.InputJsonDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSource.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessage.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSource.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessage.Json.g.cs index 6c552f7..2c8986c 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockSource.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessage.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ImageBlockSource + public sealed partial class BetaInputMessage { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ImageBlockSource? FromJson( + public static global::Anthropic.BetaInputMessage? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ImageBlockSource), - jsonSerializerContext) as global::Anthropic.ImageBlockSource; + typeof(global::Anthropic.BetaInputMessage), + jsonSerializerContext) as global::Anthropic.BetaInputMessage; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ImageBlockSource? FromJson( + public static global::Anthropic.BetaInputMessage? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ImageBlockSource), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ImageBlockSource; + typeof(global::Anthropic.BetaInputMessage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaInputMessage; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessage.g.cs new file mode 100644 index 0000000..cb0460f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessage.g.cs @@ -0,0 +1,56 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaInputMessage + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("role")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaInputMessageRoleJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaInputMessageRole Role { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.AnyOf> Content { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaInputMessage( + global::Anthropic.BetaInputMessageRole role, + global::Anthropic.AnyOf> content) + { + this.Role = role; + this.Content = content; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaInputMessage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessageRole.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessageRole.g.cs new file mode 100644 index 0000000..a5dc264 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputMessageRole.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaInputMessageRole + { + /// + /// + /// + User, + /// + /// + /// + Assistant, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaInputMessageRoleExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaInputMessageRole value) + { + return value switch + { + BetaInputMessageRole.User => "user", + BetaInputMessageRole.Assistant => "assistant", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaInputMessageRole? ToEnum(string value) + { + return value switch + { + "user" => BetaInputMessageRole.User, + "assistant" => BetaInputMessageRole.Assistant, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolComputerUse.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchema.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolComputerUse.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchema.Json.g.cs index 5032a5f..1b6e8b0 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolComputerUse.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchema.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolComputerUse + public sealed partial class BetaInputSchema { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolComputerUse? FromJson( + public static global::Anthropic.BetaInputSchema? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolComputerUse), - jsonSerializerContext) as global::Anthropic.ToolComputerUse; + typeof(global::Anthropic.BetaInputSchema), + jsonSerializerContext) as global::Anthropic.BetaInputSchema; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolComputerUse? FromJson( + public static global::Anthropic.BetaInputSchema? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolComputerUse), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolComputerUse; + typeof(global::Anthropic.BetaInputSchema), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaInputSchema; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchema.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchema.g.cs new file mode 100644 index 0000000..920ada4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchema.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaInputSchema + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaInputSchemaTypeJsonConverter))] + public global::Anthropic.BetaInputSchemaType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("properties")] + public object? Properties { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaInputSchema( + global::Anthropic.BetaInputSchemaType type, + object? properties) + { + this.Type = type; + this.Properties = properties; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaInputSchema() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchRequestCounts.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaProperties.Json.g.cs similarity index 86% rename from src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchRequestCounts.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaProperties.Json.g.cs index 82ea636..6c2e1bc 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchRequestCounts.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaProperties.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class MessageBatchRequestCounts + public sealed partial class BetaInputSchemaProperties { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.MessageBatchRequestCounts? FromJson( + public static global::Anthropic.BetaInputSchemaProperties? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.MessageBatchRequestCounts), - jsonSerializerContext) as global::Anthropic.MessageBatchRequestCounts; + typeof(global::Anthropic.BetaInputSchemaProperties), + jsonSerializerContext) as global::Anthropic.BetaInputSchemaProperties; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.MessageBatchRequestCounts? FromJson( + public static global::Anthropic.BetaInputSchemaProperties? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.MessageBatchRequestCounts), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.MessageBatchRequestCounts; + typeof(global::Anthropic.BetaInputSchemaProperties), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaInputSchemaProperties; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockInput.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaProperties.g.cs similarity index 68% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockInput.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaProperties.g.cs index a2accdb..3cb1096 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockInput.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaProperties.g.cs @@ -4,9 +4,9 @@ namespace Anthropic { /// - /// An object containing the input being passed to the tool, conforming to the tool's `input_schema`. + /// /// - public sealed partial class ToolUseBlockInput + public sealed partial class BetaInputSchemaProperties { /// @@ -16,10 +16,10 @@ public sealed partial class ToolUseBlockInput public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolUseBlockInput( + public BetaInputSchemaProperties( ) { } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaType.g.cs new file mode 100644 index 0000000..5bd2880 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInputSchemaType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaInputSchemaType + { + /// + /// + /// + Object, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaInputSchemaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaInputSchemaType value) + { + return value switch + { + BetaInputSchemaType.Object => "object", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaInputSchemaType? ToEnum(string value) + { + return value switch + { + "object" => BetaInputSchemaType.Object, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestError.Json.g.cs new file mode 100644 index 0000000..701a83f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaInvalidRequestError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaInvalidRequestError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaInvalidRequestError), + jsonSerializerContext) as global::Anthropic.BetaInvalidRequestError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaInvalidRequestError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaInvalidRequestError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaInvalidRequestError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestError.g.cs new file mode 100644 index 0000000..7bd0cdd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaInvalidRequestError + { + /// + /// Default Value: invalid_request_error + /// + /// global::Anthropic.BetaInvalidRequestErrorType.InvalidRequestError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaInvalidRequestErrorTypeJsonConverter))] + public global::Anthropic.BetaInvalidRequestErrorType Type { get; set; } = global::Anthropic.BetaInvalidRequestErrorType.InvalidRequestError; + + /// + /// Default Value: Invalid request + /// + /// "Invalid request" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Invalid request"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: invalid_request_error + /// + /// + /// Default Value: Invalid request + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaInvalidRequestError( + string message, + global::Anthropic.BetaInvalidRequestErrorType type = global::Anthropic.BetaInvalidRequestErrorType.InvalidRequestError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaInvalidRequestError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestErrorType.g.cs new file mode 100644 index 0000000..9d4edf5 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaInvalidRequestErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: invalid_request_error + /// + public enum BetaInvalidRequestErrorType + { + /// + /// + /// + InvalidRequestError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaInvalidRequestErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaInvalidRequestErrorType value) + { + return value switch + { + BetaInvalidRequestErrorType.InvalidRequestError => "invalid_request_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaInvalidRequestErrorType? ToEnum(string value) + { + return value switch + { + "invalid_request_error" => BetaInvalidRequestErrorType.InvalidRequestError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaListResponseMessageBatch.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaListResponseMessageBatch.Json.g.cs new file mode 100644 index 0000000..0536322 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaListResponseMessageBatch.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaListResponseMessageBatch + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaListResponseMessageBatch? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaListResponseMessageBatch), + jsonSerializerContext) as global::Anthropic.BetaListResponseMessageBatch; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaListResponseMessageBatch? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaListResponseMessageBatch), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaListResponseMessageBatch; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaListResponseMessageBatch.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaListResponseMessageBatch.g.cs new file mode 100644 index 0000000..c9bc9fb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaListResponseMessageBatch.g.cs @@ -0,0 +1,84 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaListResponseMessageBatch + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Data { get; set; } + + /// + /// Indicates if there are more results in the requested page direction. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("has_more")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool HasMore { get; set; } + + /// + /// First ID in the `data` list. Can be used as the `before_id` for the previous page.
+ /// Example: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + ///
+ /// msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + [global::System.Text.Json.Serialization.JsonPropertyName("first_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string? FirstId { get; set; } + + /// + /// Last ID in the `data` list. Can be used as the `after_id` for the next page.
+ /// Example: msgbatch_01HkcTjaV5uDC8jWR4ZsDV8d + ///
+ /// msgbatch_01HkcTjaV5uDC8jWR4ZsDV8d + [global::System.Text.Json.Serialization.JsonPropertyName("last_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string? LastId { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// Indicates if there are more results in the requested page direction. + /// + /// + /// First ID in the `data` list. Can be used as the `before_id` for the previous page.
+ /// Example: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + /// + /// + /// Last ID in the `data` list. Can be used as the `after_id` for the next page.
+ /// Example: msgbatch_01HkcTjaV5uDC8jWR4ZsDV8d + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaListResponseMessageBatch( + global::System.Collections.Generic.IList data, + bool hasMore, + string? firstId, + string? lastId) + { + this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + this.HasMore = hasMore; + this.FirstId = firstId ?? throw new global::System.ArgumentNullException(nameof(firstId)); + this.LastId = lastId ?? throw new global::System.ArgumentNullException(nameof(lastId)); + } + + /// + /// Initializes a new instance of the class. + /// + public BetaListResponseMessageBatch() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessage.Json.g.cs similarity index 88% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDelta.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaMessage.Json.g.cs index 7ce9284..09a8ff8 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDelta.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessage.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public readonly partial struct BlockDelta + public sealed partial class BetaMessage { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.BlockDelta? FromJson( + public static global::Anthropic.BetaMessage? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.BlockDelta), - jsonSerializerContext) as global::Anthropic.BlockDelta?; + typeof(global::Anthropic.BetaMessage), + jsonSerializerContext) as global::Anthropic.BetaMessage; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.BlockDelta? FromJson( + public static global::Anthropic.BetaMessage? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.BlockDelta), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BlockDelta?; + typeof(global::Anthropic.BetaMessage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessage; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessage.g.cs new file mode 100644 index 0000000..db04c7f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessage.g.cs @@ -0,0 +1,202 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessage + { + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time.
+ /// Example: msg_013Zva2CMHLNnXjNJJKqJ2EF + ///
+ /// msg_013Zva2CMHLNnXjNJJKqJ2EF + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message + ///
+ /// global::Anthropic.BetaMessageType.Message + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageTypeJsonConverter))] + public global::Anthropic.BetaMessageType Type { get; set; } = global::Anthropic.BetaMessageType.Message; + + /// + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant + ///
+ /// global::Anthropic.BetaMessageRole.Assistant + [global::System.Text.Json.Serialization.JsonPropertyName("role")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageRoleJsonConverter))] + public global::Anthropic.BetaMessageRole Role { get; set; } = global::Anthropic.BetaMessageRole.Assistant; + + /// + /// Content generated by the model.
+ /// This is an array of content blocks, each of which has a `type` that determines its shape.
+ /// Example:
+ /// ```json
+ /// [{"type": "text", "text": "Hi, I'm Claude."}]
+ /// ```
+ /// If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.
+ /// For example, if the input `messages` were:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("}
+ /// ]
+ /// ```
+ /// Then the response `content` might be:
+ /// ```json
+ /// [{"type": "text", "text": "B)"}]
+ /// ```
+ /// Example: [] + ///
+ /// [] + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Content { get; set; } + + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_reason")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageStopReasonJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessageStopReason? StopReason { get; set; } + + /// + /// Which custom stop sequence was generated, if any.
+ /// This value will be a non-null string if one of your custom stop sequences was generated. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_sequence")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string? StopSequence { get; set; } + + /// + /// Billing and rate-limit usage.
+ /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("usage")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaUsage Usage { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time.
+ /// Example: msg_013Zva2CMHLNnXjNJJKqJ2EF + /// + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message + /// + /// + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant + /// + /// + /// Content generated by the model.
+ /// This is an array of content blocks, each of which has a `type` that determines its shape.
+ /// Example:
+ /// ```json
+ /// [{"type": "text", "text": "Hi, I'm Claude."}]
+ /// ```
+ /// If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.
+ /// For example, if the input `messages` were:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("}
+ /// ]
+ /// ```
+ /// Then the response `content` might be:
+ /// ```json
+ /// [{"type": "text", "text": "B)"}]
+ /// ```
+ /// Example: [] + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + /// + /// + /// Which custom stop sequence was generated, if any.
+ /// This value will be a non-null string if one of your custom stop sequences was generated. + /// + /// + /// Billing and rate-limit usage.
+ /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessage( + string id, + global::System.Collections.Generic.IList content, + global::Anthropic.Model model, + global::Anthropic.BetaMessageStopReason? stopReason, + string? stopSequence, + global::Anthropic.BetaUsage usage, + global::Anthropic.BetaMessageType type = global::Anthropic.BetaMessageType.Message, + global::Anthropic.BetaMessageRole role = global::Anthropic.BetaMessageRole.Assistant) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + this.Model = model; + this.StopReason = stopReason; + this.StopSequence = stopSequence ?? throw new global::System.ArgumentNullException(nameof(stopSequence)); + this.Usage = usage ?? throw new global::System.ArgumentNullException(nameof(usage)); + this.Type = type; + this.Role = role; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatch.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatch.Json.g.cs new file mode 100644 index 0000000..f91927d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatch.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageBatch + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageBatch? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageBatch), + jsonSerializerContext) as global::Anthropic.BetaMessageBatch; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageBatch? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageBatch), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageBatch; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatch.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatch.g.cs new file mode 100644 index 0000000..9f28635 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatch.g.cs @@ -0,0 +1,172 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageBatch + { + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time.
+ /// Example: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + ///
+ /// msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// Object type.
+ /// For Message Batches, this is always `"message_batch"`.
+ /// Default Value: message_batch + ///
+ /// global::Anthropic.BetaMessageBatchType.MessageBatch + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageBatchTypeJsonConverter))] + public global::Anthropic.BetaMessageBatchType Type { get; set; } = global::Anthropic.BetaMessageBatchType.MessageBatch; + + /// + /// Processing status of the Message Batch. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("processing_status")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageBatchProcessingStatusJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessageBatchProcessingStatus ProcessingStatus { get; set; } + + /// + /// Tallies requests within the Message Batch, categorized by their status.
+ /// Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("request_counts")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaRequestCounts RequestCounts { get; set; } + + /// + /// RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
+ /// Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("ended_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime? EndedAt { get; set; } + + /// + /// RFC 3339 datetime string representing the time at which the Message Batch was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime CreatedAt { get; set; } + + /// + /// RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("expires_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime ExpiresAt { get; set; } + + /// + /// RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("archived_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime? ArchivedAt { get; set; } + + /// + /// RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cancel_initiated_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime? CancelInitiatedAt { get; set; } + + /// + /// URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
+ /// Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.
+ /// Example: https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results + ///
+ /// https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results + [global::System.Text.Json.Serialization.JsonPropertyName("results_url")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string? ResultsUrl { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time.
+ /// Example: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + /// + /// + /// Object type.
+ /// For Message Batches, this is always `"message_batch"`.
+ /// Default Value: message_batch + /// + /// + /// Processing status of the Message Batch. + /// + /// + /// Tallies requests within the Message Batch, categorized by their status.
+ /// Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + /// + /// + /// RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
+ /// Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + /// + /// + /// RFC 3339 datetime string representing the time at which the Message Batch was created. + /// + /// + /// RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + /// + /// + /// RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + /// + /// + /// RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + /// + /// + /// URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
+ /// Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.
+ /// Example: https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageBatch( + string id, + global::Anthropic.BetaMessageBatchProcessingStatus processingStatus, + global::Anthropic.BetaRequestCounts requestCounts, + global::System.DateTime? endedAt, + global::System.DateTime createdAt, + global::System.DateTime expiresAt, + global::System.DateTime? archivedAt, + global::System.DateTime? cancelInitiatedAt, + string? resultsUrl, + global::Anthropic.BetaMessageBatchType type = global::Anthropic.BetaMessageBatchType.MessageBatch) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.ProcessingStatus = processingStatus; + this.RequestCounts = requestCounts ?? throw new global::System.ArgumentNullException(nameof(requestCounts)); + this.EndedAt = endedAt; + this.CreatedAt = createdAt; + this.ExpiresAt = expiresAt; + this.ArchivedAt = archivedAt; + this.CancelInitiatedAt = cancelInitiatedAt; + this.ResultsUrl = resultsUrl ?? throw new global::System.ArgumentNullException(nameof(resultsUrl)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageBatch() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualRequestParams.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualRequestParams.Json.g.cs new file mode 100644 index 0000000..671d44f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualRequestParams.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageBatchIndividualRequestParams + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageBatchIndividualRequestParams? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageBatchIndividualRequestParams), + jsonSerializerContext) as global::Anthropic.BetaMessageBatchIndividualRequestParams; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageBatchIndividualRequestParams? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageBatchIndividualRequestParams), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageBatchIndividualRequestParams; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BatchMessageRequest.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualRequestParams.g.cs similarity index 56% rename from src/libs/Anthropic/Generated/Anthropic.Models.BatchMessageRequest.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualRequestParams.g.cs index bfe60d4..6b9fb43 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BatchMessageRequest.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualRequestParams.g.cs @@ -4,25 +4,27 @@ namespace Anthropic { /// - /// An individual message request within a batch. + /// /// - public sealed partial class BatchMessageRequest + public sealed partial class BetaMessageBatchIndividualRequestParams { /// - /// Developer-provided ID created for each request in a Message Batch. Useful for
- /// matching results to requests, as results may be given out of request order.
- /// Must be unique for each request within the Message Batch. + /// Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
+ /// Must be unique for each request within the Message Batch.
+ /// Example: my-custom-id-1 ///
+ /// my-custom-id-1 [global::System.Text.Json.Serialization.JsonPropertyName("custom_id")] [global::System.Text.Json.Serialization.JsonRequired] public required string CustomId { get; set; } /// - /// The request parameters for creating a message. + /// Messages API creation parameters for the individual request.
+ /// See the [Messages API reference](/en/api/messages) for full documentation on available parameters. ///
[global::System.Text.Json.Serialization.JsonPropertyName("params")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.CreateMessageRequest Params { get; set; } + public required global::Anthropic.BetaCreateMessageParams Params { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -31,29 +33,30 @@ public sealed partial class BatchMessageRequest public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// Developer-provided ID created for each request in a Message Batch. Useful for
- /// matching results to requests, as results may be given out of request order.
- /// Must be unique for each request within the Message Batch. + /// Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
+ /// Must be unique for each request within the Message Batch.
+ /// Example: my-custom-id-1 /// /// - /// The request parameters for creating a message. + /// Messages API creation parameters for the individual request.
+ /// See the [Messages API reference](/en/api/messages) for full documentation on available parameters. /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public BatchMessageRequest( + public BetaMessageBatchIndividualRequestParams( string customId, - global::Anthropic.CreateMessageRequest @params) + global::Anthropic.BetaCreateMessageParams @params) { this.CustomId = customId ?? throw new global::System.ArgumentNullException(nameof(customId)); this.Params = @params ?? throw new global::System.ArgumentNullException(nameof(@params)); } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public BatchMessageRequest() + public BetaMessageBatchIndividualRequestParams() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualResponse.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualResponse.Json.g.cs new file mode 100644 index 0000000..39de091 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageBatchIndividualResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageBatchIndividualResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageBatchIndividualResponse), + jsonSerializerContext) as global::Anthropic.BetaMessageBatchIndividualResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageBatchIndividualResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageBatchIndividualResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageBatchIndividualResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualResponse.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualResponse.g.cs new file mode 100644 index 0000000..9f70dac --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchIndividualResponse.g.cs @@ -0,0 +1,64 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageBatchIndividualResponse + { + /// + /// Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
+ /// Must be unique for each request within the Message Batch.
+ /// Example: my-custom-id-1 + ///
+ /// my-custom-id-1 + [global::System.Text.Json.Serialization.JsonPropertyName("custom_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string CustomId { get; set; } + + /// + /// Processing result for this request.
+ /// Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("result")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageBatchResultJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessageBatchResult Result { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
+ /// Must be unique for each request within the Message Batch.
+ /// Example: my-custom-id-1 + /// + /// + /// Processing result for this request.
+ /// Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageBatchIndividualResponse( + string customId, + global::Anthropic.BetaMessageBatchResult result) + { + this.CustomId = customId ?? throw new global::System.ArgumentNullException(nameof(customId)); + this.Result = result; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageBatchIndividualResponse() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchProcessingStatus.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchProcessingStatus.g.cs similarity index 56% rename from src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchProcessingStatus.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchProcessingStatus.g.cs index 4d2d297..dd79a07 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchProcessingStatus.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchProcessingStatus.g.cs @@ -6,7 +6,7 @@ namespace Anthropic /// /// Processing status of the Message Batch. /// - public enum MessageBatchProcessingStatus + public enum BetaMessageBatchProcessingStatus { /// /// @@ -25,31 +25,31 @@ public enum MessageBatchProcessingStatus /// /// Enum extensions to do fast conversions without the reflection. /// - public static class MessageBatchProcessingStatusExtensions + public static class BetaMessageBatchProcessingStatusExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this MessageBatchProcessingStatus value) + public static string ToValueString(this BetaMessageBatchProcessingStatus value) { return value switch { - MessageBatchProcessingStatus.InProgress => "in_progress", - MessageBatchProcessingStatus.Canceling => "canceling", - MessageBatchProcessingStatus.Ended => "ended", + BetaMessageBatchProcessingStatus.InProgress => "in_progress", + BetaMessageBatchProcessingStatus.Canceling => "canceling", + BetaMessageBatchProcessingStatus.Ended => "ended", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static MessageBatchProcessingStatus? ToEnum(string value) + public static BetaMessageBatchProcessingStatus? ToEnum(string value) { return value switch { - "in_progress" => MessageBatchProcessingStatus.InProgress, - "canceling" => MessageBatchProcessingStatus.Canceling, - "ended" => MessageBatchProcessingStatus.Ended, + "in_progress" => BetaMessageBatchProcessingStatus.InProgress, + "canceling" => BetaMessageBatchProcessingStatus.Canceling, + "ended" => BetaMessageBatchProcessingStatus.Ended, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResult.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResult.Json.g.cs new file mode 100644 index 0000000..4c2229d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResult.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct BetaMessageBatchResult + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageBatchResult? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageBatchResult), + jsonSerializerContext) as global::Anthropic.BetaMessageBatchResult?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageBatchResult? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageBatchResult), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageBatchResult?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResult.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResult.g.cs new file mode 100644 index 0000000..3b7f10f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResult.g.cs @@ -0,0 +1,325 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// Processing result for this request.
+ /// Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + ///
+ public readonly partial struct BetaMessageBatchResult : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaMessageBatchResultDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaSucceededResult? Succeeded { get; init; } +#else + public global::Anthropic.BetaSucceededResult? Succeeded { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Succeeded))] +#endif + public bool IsSucceeded => Succeeded != null; + + /// + /// + /// + public static implicit operator BetaMessageBatchResult(global::Anthropic.BetaSucceededResult value) => new BetaMessageBatchResult(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaSucceededResult?(BetaMessageBatchResult @this) => @this.Succeeded; + + /// + /// + /// + public BetaMessageBatchResult(global::Anthropic.BetaSucceededResult? value) + { + Succeeded = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaErroredResult? Errored { get; init; } +#else + public global::Anthropic.BetaErroredResult? Errored { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Errored))] +#endif + public bool IsErrored => Errored != null; + + /// + /// + /// + public static implicit operator BetaMessageBatchResult(global::Anthropic.BetaErroredResult value) => new BetaMessageBatchResult(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaErroredResult?(BetaMessageBatchResult @this) => @this.Errored; + + /// + /// + /// + public BetaMessageBatchResult(global::Anthropic.BetaErroredResult? value) + { + Errored = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaCanceledResult? Canceled { get; init; } +#else + public global::Anthropic.BetaCanceledResult? Canceled { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Canceled))] +#endif + public bool IsCanceled => Canceled != null; + + /// + /// + /// + public static implicit operator BetaMessageBatchResult(global::Anthropic.BetaCanceledResult value) => new BetaMessageBatchResult(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaCanceledResult?(BetaMessageBatchResult @this) => @this.Canceled; + + /// + /// + /// + public BetaMessageBatchResult(global::Anthropic.BetaCanceledResult? value) + { + Canceled = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaExpiredResult? Expired { get; init; } +#else + public global::Anthropic.BetaExpiredResult? Expired { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Expired))] +#endif + public bool IsExpired => Expired != null; + + /// + /// + /// + public static implicit operator BetaMessageBatchResult(global::Anthropic.BetaExpiredResult value) => new BetaMessageBatchResult(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaExpiredResult?(BetaMessageBatchResult @this) => @this.Expired; + + /// + /// + /// + public BetaMessageBatchResult(global::Anthropic.BetaExpiredResult? value) + { + Expired = value; + } + + /// + /// + /// + public BetaMessageBatchResult( + global::Anthropic.BetaMessageBatchResultDiscriminatorType? type, + global::Anthropic.BetaSucceededResult? succeeded, + global::Anthropic.BetaErroredResult? errored, + global::Anthropic.BetaCanceledResult? canceled, + global::Anthropic.BetaExpiredResult? expired + ) + { + Type = type; + + Succeeded = succeeded; + Errored = errored; + Canceled = canceled; + Expired = expired; + } + + /// + /// + /// + public object? Object => + Expired as object ?? + Canceled as object ?? + Errored as object ?? + Succeeded as object + ; + + /// + /// + /// + public bool Validate() + { + return IsSucceeded && !IsErrored && !IsCanceled && !IsExpired || !IsSucceeded && IsErrored && !IsCanceled && !IsExpired || !IsSucceeded && !IsErrored && IsCanceled && !IsExpired || !IsSucceeded && !IsErrored && !IsCanceled && IsExpired; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? succeeded = null, + global::System.Func? errored = null, + global::System.Func? canceled = null, + global::System.Func? expired = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsSucceeded && succeeded != null) + { + return succeeded(Succeeded!); + } + else if (IsErrored && errored != null) + { + return errored(Errored!); + } + else if (IsCanceled && canceled != null) + { + return canceled(Canceled!); + } + else if (IsExpired && expired != null) + { + return expired(Expired!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? succeeded = null, + global::System.Action? errored = null, + global::System.Action? canceled = null, + global::System.Action? expired = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsSucceeded) + { + succeeded?.Invoke(Succeeded!); + } + else if (IsErrored) + { + errored?.Invoke(Errored!); + } + else if (IsCanceled) + { + canceled?.Invoke(Canceled!); + } + else if (IsExpired) + { + expired?.Invoke(Expired!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Succeeded, + typeof(global::Anthropic.BetaSucceededResult), + Errored, + typeof(global::Anthropic.BetaErroredResult), + Canceled, + typeof(global::Anthropic.BetaCanceledResult), + Expired, + typeof(global::Anthropic.BetaExpiredResult), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(BetaMessageBatchResult other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Succeeded, other.Succeeded) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Errored, other.Errored) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Canceled, other.Canceled) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Expired, other.Expired) + ; + } + + /// + /// + /// + public static bool operator ==(BetaMessageBatchResult obj1, BetaMessageBatchResult obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(BetaMessageBatchResult obj1, BetaMessageBatchResult obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is BetaMessageBatchResult o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminator.Json.g.cs new file mode 100644 index 0000000..28efb8e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageBatchResultDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageBatchResultDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageBatchResultDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaMessageBatchResultDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageBatchResultDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageBatchResultDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageBatchResultDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminator.g.cs new file mode 100644 index 0000000..22f449a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageBatchResultDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageBatchResultDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaMessageBatchResultDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageBatchResultDiscriminator( + global::Anthropic.BetaMessageBatchResultDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageBatchResultDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminatorType.g.cs new file mode 100644 index 0000000..eb933cb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchResultDiscriminatorType.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaMessageBatchResultDiscriminatorType + { + /// + /// + /// + Canceled, + /// + /// + /// + Errored, + /// + /// + /// + Expired, + /// + /// + /// + Succeeded, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageBatchResultDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageBatchResultDiscriminatorType value) + { + return value switch + { + BetaMessageBatchResultDiscriminatorType.Canceled => "canceled", + BetaMessageBatchResultDiscriminatorType.Errored => "errored", + BetaMessageBatchResultDiscriminatorType.Expired => "expired", + BetaMessageBatchResultDiscriminatorType.Succeeded => "succeeded", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageBatchResultDiscriminatorType? ToEnum(string value) + { + return value switch + { + "canceled" => BetaMessageBatchResultDiscriminatorType.Canceled, + "errored" => BetaMessageBatchResultDiscriminatorType.Errored, + "expired" => BetaMessageBatchResultDiscriminatorType.Expired, + "succeeded" => BetaMessageBatchResultDiscriminatorType.Succeeded, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchType.g.cs new file mode 100644 index 0000000..bf0a91e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageBatchType.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Object type.
+ /// For Message Batches, this is always `"message_batch"`.
+ /// Default Value: message_batch + ///
+ public enum BetaMessageBatchType + { + /// + /// + /// + MessageBatch, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageBatchTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageBatchType value) + { + return value switch + { + BetaMessageBatchType.MessageBatch => "message_batch", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageBatchType? ToEnum(string value) + { + return value switch + { + "message_batch" => BetaMessageBatchType.MessageBatch, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDelta.Json.g.cs new file mode 100644 index 0000000..e63b5ba --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDelta.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageDelta + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageDelta? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageDelta), + jsonSerializerContext) as global::Anthropic.BetaMessageDelta; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageDelta? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageDelta), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageDelta; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDelta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDelta.g.cs new file mode 100644 index 0000000..a597f93 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDelta.g.cs @@ -0,0 +1,53 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageDelta + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("stop_reason")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageDeltaStopReasonJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessageDeltaStopReason? StopReason { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("stop_sequence")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string? StopSequence { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageDelta( + global::Anthropic.BetaMessageDeltaStopReason? stopReason, + string? stopSequence) + { + this.StopReason = stopReason; + this.StopSequence = stopSequence ?? throw new global::System.ArgumentNullException(nameof(stopSequence)); + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageDelta() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEvent.Json.g.cs new file mode 100644 index 0000000..bbbbf3a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageDeltaEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageDeltaEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageDeltaEvent), + jsonSerializerContext) as global::Anthropic.BetaMessageDeltaEvent; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageDeltaEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageDeltaEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageDeltaEvent; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEvent.g.cs new file mode 100644 index 0000000..f8b634e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEvent.g.cs @@ -0,0 +1,73 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageDeltaEvent + { + /// + /// Default Value: message_delta + /// + /// global::Anthropic.BetaMessageDeltaEventType.MessageDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageDeltaEventTypeJsonConverter))] + public global::Anthropic.BetaMessageDeltaEventType Type { get; set; } = global::Anthropic.BetaMessageDeltaEventType.MessageDelta; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("delta")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessageDelta Delta { get; set; } + + /// + /// Billing and rate-limit usage.
+ /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("usage")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessageDeltaUsage Usage { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: message_delta + /// + /// + /// + /// Billing and rate-limit usage.
+ /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageDeltaEvent( + global::Anthropic.BetaMessageDelta delta, + global::Anthropic.BetaMessageDeltaUsage usage, + global::Anthropic.BetaMessageDeltaEventType type = global::Anthropic.BetaMessageDeltaEventType.MessageDelta) + { + this.Delta = delta ?? throw new global::System.ArgumentNullException(nameof(delta)); + this.Usage = usage ?? throw new global::System.ArgumentNullException(nameof(usage)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageDeltaEvent() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEventType.g.cs new file mode 100644 index 0000000..fe94e44 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: message_delta + /// + public enum BetaMessageDeltaEventType + { + /// + /// + /// + MessageDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageDeltaEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageDeltaEventType value) + { + return value switch + { + BetaMessageDeltaEventType.MessageDelta => "message_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageDeltaEventType? ToEnum(string value) + { + return value switch + { + "message_delta" => BetaMessageDeltaEventType.MessageDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaStopReason.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaStopReason.g.cs new file mode 100644 index 0000000..cb10f8f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaStopReason.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaMessageDeltaStopReason + { + /// + /// + /// + EndTurn, + /// + /// + /// + MaxTokens, + /// + /// + /// + StopSequence, + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageDeltaStopReasonExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageDeltaStopReason value) + { + return value switch + { + BetaMessageDeltaStopReason.EndTurn => "end_turn", + BetaMessageDeltaStopReason.MaxTokens => "max_tokens", + BetaMessageDeltaStopReason.StopSequence => "stop_sequence", + BetaMessageDeltaStopReason.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageDeltaStopReason? ToEnum(string value) + { + return value switch + { + "end_turn" => BetaMessageDeltaStopReason.EndTurn, + "max_tokens" => BetaMessageDeltaStopReason.MaxTokens, + "stop_sequence" => BetaMessageDeltaStopReason.StopSequence, + "tool_use" => BetaMessageDeltaStopReason.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaUsage.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaUsage.Json.g.cs new file mode 100644 index 0000000..0ee930e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaUsage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageDeltaUsage + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageDeltaUsage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageDeltaUsage), + jsonSerializerContext) as global::Anthropic.BetaMessageDeltaUsage; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageDeltaUsage? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageDeltaUsage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageDeltaUsage; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaUsage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaUsage.g.cs new file mode 100644 index 0000000..26df093 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageDeltaUsage.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageDeltaUsage + { + /// + /// The cumulative number of output tokens which were used.
+ /// Example: 503 + ///
+ /// 503 + [global::System.Text.Json.Serialization.JsonPropertyName("output_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int OutputTokens { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The cumulative number of output tokens which were used.
+ /// Example: 503 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageDeltaUsage( + int outputTokens) + { + this.OutputTokens = outputTokens; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageDeltaUsage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageRole.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageRole.g.cs new file mode 100644 index 0000000..75db3e2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageRole.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant + ///
+ public enum BetaMessageRole + { + /// + /// + /// + Assistant, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageRoleExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageRole value) + { + return value switch + { + BetaMessageRole.Assistant => "assistant", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageRole? ToEnum(string value) + { + return value switch + { + "assistant" => BetaMessageRole.Assistant, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEvent.Json.g.cs new file mode 100644 index 0000000..82f9999 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageStartEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageStartEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageStartEvent), + jsonSerializerContext) as global::Anthropic.BetaMessageStartEvent; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageStartEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageStartEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageStartEvent; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEvent.g.cs new file mode 100644 index 0000000..ac57045 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEvent.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageStartEvent + { + /// + /// Default Value: message_start + /// + /// global::Anthropic.BetaMessageStartEventType.MessageStart + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageStartEventTypeJsonConverter))] + public global::Anthropic.BetaMessageStartEventType Type { get; set; } = global::Anthropic.BetaMessageStartEventType.MessageStart; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessage Message { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: message_start + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageStartEvent( + global::Anthropic.BetaMessage message, + global::Anthropic.BetaMessageStartEventType type = global::Anthropic.BetaMessageStartEventType.MessageStart) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageStartEvent() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEventType.g.cs new file mode 100644 index 0000000..bf95306 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStartEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: message_start + /// + public enum BetaMessageStartEventType + { + /// + /// + /// + MessageStart, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageStartEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageStartEventType value) + { + return value switch + { + BetaMessageStartEventType.MessageStart => "message_start", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageStartEventType? ToEnum(string value) + { + return value switch + { + "message_start" => BetaMessageStartEventType.MessageStart, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEvent.Json.g.cs new file mode 100644 index 0000000..67db4cb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageStopEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageStopEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageStopEvent), + jsonSerializerContext) as global::Anthropic.BetaMessageStopEvent; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageStopEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageStopEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageStopEvent; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEvent.g.cs new file mode 100644 index 0000000..c4e686b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEvent.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageStopEvent + { + /// + /// Default Value: message_stop + /// + /// global::Anthropic.BetaMessageStopEventType.MessageStop + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageStopEventTypeJsonConverter))] + public global::Anthropic.BetaMessageStopEventType Type { get; set; } = global::Anthropic.BetaMessageStopEventType.MessageStop; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: message_stop + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageStopEvent( + global::Anthropic.BetaMessageStopEventType type = global::Anthropic.BetaMessageStopEventType.MessageStop) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageStopEvent() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEventType.g.cs new file mode 100644 index 0000000..60947dc --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: message_stop + /// + public enum BetaMessageStopEventType + { + /// + /// + /// + MessageStop, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageStopEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageStopEventType value) + { + return value switch + { + BetaMessageStopEventType.MessageStop => "message_stop", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageStopEventType? ToEnum(string value) + { + return value switch + { + "message_stop" => BetaMessageStopEventType.MessageStop, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopReason.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopReason.g.cs new file mode 100644 index 0000000..d9a7877 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStopReason.g.cs @@ -0,0 +1,69 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + ///
+ public enum BetaMessageStopReason + { + /// + /// the model reached a natural stopping point + /// + EndTurn, + /// + /// we exceeded the requested `max_tokens` or the model's maximum + /// + MaxTokens, + /// + /// one of your provided custom `stop_sequences` was generated + /// + StopSequence, + /// + /// the model invoked one or more tools + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageStopReasonExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageStopReason value) + { + return value switch + { + BetaMessageStopReason.EndTurn => "end_turn", + BetaMessageStopReason.MaxTokens => "max_tokens", + BetaMessageStopReason.StopSequence => "stop_sequence", + BetaMessageStopReason.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageStopReason? ToEnum(string value) + { + return value switch + { + "end_turn" => BetaMessageStopReason.EndTurn, + "max_tokens" => BetaMessageStopReason.MaxTokens, + "stop_sequence" => BetaMessageStopReason.StopSequence, + "tool_use" => BetaMessageStopReason.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEvent.Json.g.cs new file mode 100644 index 0000000..4233986 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct BetaMessageStreamEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageStreamEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageStreamEvent), + jsonSerializerContext) as global::Anthropic.BetaMessageStreamEvent?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageStreamEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageStreamEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageStreamEvent?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEvent.g.cs new file mode 100644 index 0000000..ffb0d96 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEvent.g.cs @@ -0,0 +1,426 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct BetaMessageStreamEvent : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaMessageStreamEventDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaMessageStartEvent? MessageStart { get; init; } +#else + public global::Anthropic.BetaMessageStartEvent? MessageStart { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageStart))] +#endif + public bool IsMessageStart => MessageStart != null; + + /// + /// + /// + public static implicit operator BetaMessageStreamEvent(global::Anthropic.BetaMessageStartEvent value) => new BetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaMessageStartEvent?(BetaMessageStreamEvent @this) => @this.MessageStart; + + /// + /// + /// + public BetaMessageStreamEvent(global::Anthropic.BetaMessageStartEvent? value) + { + MessageStart = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaMessageDeltaEvent? MessageDelta { get; init; } +#else + public global::Anthropic.BetaMessageDeltaEvent? MessageDelta { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageDelta))] +#endif + public bool IsMessageDelta => MessageDelta != null; + + /// + /// + /// + public static implicit operator BetaMessageStreamEvent(global::Anthropic.BetaMessageDeltaEvent value) => new BetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaMessageDeltaEvent?(BetaMessageStreamEvent @this) => @this.MessageDelta; + + /// + /// + /// + public BetaMessageStreamEvent(global::Anthropic.BetaMessageDeltaEvent? value) + { + MessageDelta = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaMessageStopEvent? MessageStop { get; init; } +#else + public global::Anthropic.BetaMessageStopEvent? MessageStop { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageStop))] +#endif + public bool IsMessageStop => MessageStop != null; + + /// + /// + /// + public static implicit operator BetaMessageStreamEvent(global::Anthropic.BetaMessageStopEvent value) => new BetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaMessageStopEvent?(BetaMessageStreamEvent @this) => @this.MessageStop; + + /// + /// + /// + public BetaMessageStreamEvent(global::Anthropic.BetaMessageStopEvent? value) + { + MessageStop = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaContentBlockStartEvent? ContentBlockStart { get; init; } +#else + public global::Anthropic.BetaContentBlockStartEvent? ContentBlockStart { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ContentBlockStart))] +#endif + public bool IsContentBlockStart => ContentBlockStart != null; + + /// + /// + /// + public static implicit operator BetaMessageStreamEvent(global::Anthropic.BetaContentBlockStartEvent value) => new BetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaContentBlockStartEvent?(BetaMessageStreamEvent @this) => @this.ContentBlockStart; + + /// + /// + /// + public BetaMessageStreamEvent(global::Anthropic.BetaContentBlockStartEvent? value) + { + ContentBlockStart = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaContentBlockDeltaEvent? ContentBlockDelta { get; init; } +#else + public global::Anthropic.BetaContentBlockDeltaEvent? ContentBlockDelta { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ContentBlockDelta))] +#endif + public bool IsContentBlockDelta => ContentBlockDelta != null; + + /// + /// + /// + public static implicit operator BetaMessageStreamEvent(global::Anthropic.BetaContentBlockDeltaEvent value) => new BetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaContentBlockDeltaEvent?(BetaMessageStreamEvent @this) => @this.ContentBlockDelta; + + /// + /// + /// + public BetaMessageStreamEvent(global::Anthropic.BetaContentBlockDeltaEvent? value) + { + ContentBlockDelta = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaContentBlockStopEvent? ContentBlockStop { get; init; } +#else + public global::Anthropic.BetaContentBlockStopEvent? ContentBlockStop { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ContentBlockStop))] +#endif + public bool IsContentBlockStop => ContentBlockStop != null; + + /// + /// + /// + public static implicit operator BetaMessageStreamEvent(global::Anthropic.BetaContentBlockStopEvent value) => new BetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaContentBlockStopEvent?(BetaMessageStreamEvent @this) => @this.ContentBlockStop; + + /// + /// + /// + public BetaMessageStreamEvent(global::Anthropic.BetaContentBlockStopEvent? value) + { + ContentBlockStop = value; + } + + /// + /// + /// + public BetaMessageStreamEvent( + global::Anthropic.BetaMessageStreamEventDiscriminatorType? type, + global::Anthropic.BetaMessageStartEvent? messageStart, + global::Anthropic.BetaMessageDeltaEvent? messageDelta, + global::Anthropic.BetaMessageStopEvent? messageStop, + global::Anthropic.BetaContentBlockStartEvent? contentBlockStart, + global::Anthropic.BetaContentBlockDeltaEvent? contentBlockDelta, + global::Anthropic.BetaContentBlockStopEvent? contentBlockStop + ) + { + Type = type; + + MessageStart = messageStart; + MessageDelta = messageDelta; + MessageStop = messageStop; + ContentBlockStart = contentBlockStart; + ContentBlockDelta = contentBlockDelta; + ContentBlockStop = contentBlockStop; + } + + /// + /// + /// + public object? Object => + ContentBlockStop as object ?? + ContentBlockDelta as object ?? + ContentBlockStart as object ?? + MessageStop as object ?? + MessageDelta as object ?? + MessageStart as object + ; + + /// + /// + /// + public bool Validate() + { + return IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && !IsMessageStop && IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && IsContentBlockStop; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? messageStart = null, + global::System.Func? messageDelta = null, + global::System.Func? messageStop = null, + global::System.Func? contentBlockStart = null, + global::System.Func? contentBlockDelta = null, + global::System.Func? contentBlockStop = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsMessageStart && messageStart != null) + { + return messageStart(MessageStart!); + } + else if (IsMessageDelta && messageDelta != null) + { + return messageDelta(MessageDelta!); + } + else if (IsMessageStop && messageStop != null) + { + return messageStop(MessageStop!); + } + else if (IsContentBlockStart && contentBlockStart != null) + { + return contentBlockStart(ContentBlockStart!); + } + else if (IsContentBlockDelta && contentBlockDelta != null) + { + return contentBlockDelta(ContentBlockDelta!); + } + else if (IsContentBlockStop && contentBlockStop != null) + { + return contentBlockStop(ContentBlockStop!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? messageStart = null, + global::System.Action? messageDelta = null, + global::System.Action? messageStop = null, + global::System.Action? contentBlockStart = null, + global::System.Action? contentBlockDelta = null, + global::System.Action? contentBlockStop = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsMessageStart) + { + messageStart?.Invoke(MessageStart!); + } + else if (IsMessageDelta) + { + messageDelta?.Invoke(MessageDelta!); + } + else if (IsMessageStop) + { + messageStop?.Invoke(MessageStop!); + } + else if (IsContentBlockStart) + { + contentBlockStart?.Invoke(ContentBlockStart!); + } + else if (IsContentBlockDelta) + { + contentBlockDelta?.Invoke(ContentBlockDelta!); + } + else if (IsContentBlockStop) + { + contentBlockStop?.Invoke(ContentBlockStop!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + MessageStart, + typeof(global::Anthropic.BetaMessageStartEvent), + MessageDelta, + typeof(global::Anthropic.BetaMessageDeltaEvent), + MessageStop, + typeof(global::Anthropic.BetaMessageStopEvent), + ContentBlockStart, + typeof(global::Anthropic.BetaContentBlockStartEvent), + ContentBlockDelta, + typeof(global::Anthropic.BetaContentBlockDeltaEvent), + ContentBlockStop, + typeof(global::Anthropic.BetaContentBlockStopEvent), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(BetaMessageStreamEvent other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageStart, other.MessageStart) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageDelta, other.MessageDelta) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageStop, other.MessageStop) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockStart, other.ContentBlockStart) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockDelta, other.ContentBlockDelta) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockStop, other.ContentBlockStop) + ; + } + + /// + /// + /// + public static bool operator ==(BetaMessageStreamEvent obj1, BetaMessageStreamEvent obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(BetaMessageStreamEvent obj1, BetaMessageStreamEvent obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is BetaMessageStreamEvent o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminator.Json.g.cs new file mode 100644 index 0000000..ebc1702 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMessageStreamEventDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMessageStreamEventDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMessageStreamEventDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaMessageStreamEventDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMessageStreamEventDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMessageStreamEventDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMessageStreamEventDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminator.g.cs new file mode 100644 index 0000000..7573c0d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaMessageStreamEventDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaMessageStreamEventDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaMessageStreamEventDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaMessageStreamEventDiscriminator( + global::Anthropic.BetaMessageStreamEventDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaMessageStreamEventDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminatorType.g.cs new file mode 100644 index 0000000..bdfa5f8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageStreamEventDiscriminatorType.g.cs @@ -0,0 +1,75 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaMessageStreamEventDiscriminatorType + { + /// + /// + /// + ContentBlockDelta, + /// + /// + /// + ContentBlockStart, + /// + /// + /// + ContentBlockStop, + /// + /// + /// + MessageDelta, + /// + /// + /// + MessageStart, + /// + /// + /// + MessageStop, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageStreamEventDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageStreamEventDiscriminatorType value) + { + return value switch + { + BetaMessageStreamEventDiscriminatorType.ContentBlockDelta => "content_block_delta", + BetaMessageStreamEventDiscriminatorType.ContentBlockStart => "content_block_start", + BetaMessageStreamEventDiscriminatorType.ContentBlockStop => "content_block_stop", + BetaMessageStreamEventDiscriminatorType.MessageDelta => "message_delta", + BetaMessageStreamEventDiscriminatorType.MessageStart => "message_start", + BetaMessageStreamEventDiscriminatorType.MessageStop => "message_stop", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageStreamEventDiscriminatorType? ToEnum(string value) + { + return value switch + { + "content_block_delta" => BetaMessageStreamEventDiscriminatorType.ContentBlockDelta, + "content_block_start" => BetaMessageStreamEventDiscriminatorType.ContentBlockStart, + "content_block_stop" => BetaMessageStreamEventDiscriminatorType.ContentBlockStop, + "message_delta" => BetaMessageStreamEventDiscriminatorType.MessageDelta, + "message_start" => BetaMessageStreamEventDiscriminatorType.MessageStart, + "message_stop" => BetaMessageStreamEventDiscriminatorType.MessageStop, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageType.g.cs new file mode 100644 index 0000000..410d477 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMessageType.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message + ///
+ public enum BetaMessageType + { + /// + /// + /// + Message, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaMessageTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaMessageType value) + { + return value switch + { + BetaMessageType.Message => "message", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaMessageType? ToEnum(string value) + { + return value switch + { + "message" => BetaMessageType.Message, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaMetadata.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMetadata.Json.g.cs new file mode 100644 index 0000000..d285957 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMetadata.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaMetadata + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaMetadata? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaMetadata), + jsonSerializerContext) as global::Anthropic.BetaMetadata; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaMetadata? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaMetadata), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaMetadata; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestMetadata.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMetadata.g.cs similarity index 62% rename from src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestMetadata.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaMetadata.g.cs index 191a8e8..3b354c2 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestMetadata.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaMetadata.g.cs @@ -4,16 +4,16 @@ namespace Anthropic { /// - /// An object describing metadata about the request. + /// /// - public sealed partial class CreateMessageRequestMetadata + public sealed partial class BetaMetadata { /// /// An external identifier for the user who is associated with the request.
- /// This should be a uuid, hash value, or other opaque identifier. Anthropic may use
- /// this id to help detect abuse. Do not include any identifying information such as
- /// name, email address, or phone number. + /// This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
+ /// Example: 13803d75-b4b5-4c3e-b2a2-6f21399b021b ///
+ /// 13803d75-b4b5-4c3e-b2a2-6f21399b021b [global::System.Text.Json.Serialization.JsonPropertyName("user_id")] public string? UserId { get; set; } @@ -24,25 +24,24 @@ public sealed partial class CreateMessageRequestMetadata public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// An external identifier for the user who is associated with the request.
- /// This should be a uuid, hash value, or other opaque identifier. Anthropic may use
- /// this id to help detect abuse. Do not include any identifying information such as
- /// name, email address, or phone number. + /// This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
+ /// Example: 13803d75-b4b5-4c3e-b2a2-6f21399b021b /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public CreateMessageRequestMetadata( + public BetaMetadata( string? userId) { this.UserId = userId; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public CreateMessageRequestMetadata() + public BetaMetadata() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundError.Json.g.cs new file mode 100644 index 0000000..3c7c265 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaNotFoundError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaNotFoundError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaNotFoundError), + jsonSerializerContext) as global::Anthropic.BetaNotFoundError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaNotFoundError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaNotFoundError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaNotFoundError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundError.g.cs new file mode 100644 index 0000000..ac3cbb2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaNotFoundError + { + /// + /// Default Value: not_found_error + /// + /// global::Anthropic.BetaNotFoundErrorType.NotFoundError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaNotFoundErrorTypeJsonConverter))] + public global::Anthropic.BetaNotFoundErrorType Type { get; set; } = global::Anthropic.BetaNotFoundErrorType.NotFoundError; + + /// + /// Default Value: Not found + /// + /// "Not found" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Not found"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: not_found_error + /// + /// + /// Default Value: Not found + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaNotFoundError( + string message, + global::Anthropic.BetaNotFoundErrorType type = global::Anthropic.BetaNotFoundErrorType.NotFoundError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaNotFoundError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundErrorType.g.cs similarity index 62% rename from src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundErrorType.g.cs index 2eb6eae..7220d00 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaNotFoundErrorType.g.cs @@ -4,40 +4,40 @@ namespace Anthropic { /// - /// Object type. For Message Batches, this is always `"message_batch"`. + /// Default Value: not_found_error /// - public enum MessageBatchType + public enum BetaNotFoundErrorType { /// /// /// - MessageBatch, + NotFoundError, } /// /// Enum extensions to do fast conversions without the reflection. /// - public static class MessageBatchTypeExtensions + public static class BetaNotFoundErrorTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this MessageBatchType value) + public static string ToValueString(this BetaNotFoundErrorType value) { return value switch { - MessageBatchType.MessageBatch => "message_batch", + BetaNotFoundErrorType.NotFoundError => "not_found_error", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static MessageBatchType? ToEnum(string value) + public static BetaNotFoundErrorType? ToEnum(string value) { return value switch { - "message_batch" => MessageBatchType.MessageBatch, + "not_found_error" => BetaNotFoundErrorType.NotFoundError, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedError.Json.g.cs new file mode 100644 index 0000000..99d1861 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaOverloadedError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaOverloadedError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaOverloadedError), + jsonSerializerContext) as global::Anthropic.BetaOverloadedError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaOverloadedError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaOverloadedError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaOverloadedError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedError.g.cs new file mode 100644 index 0000000..13fc386 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaOverloadedError + { + /// + /// Default Value: overloaded_error + /// + /// global::Anthropic.BetaOverloadedErrorType.OverloadedError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaOverloadedErrorTypeJsonConverter))] + public global::Anthropic.BetaOverloadedErrorType Type { get; set; } = global::Anthropic.BetaOverloadedErrorType.OverloadedError; + + /// + /// Default Value: Overloaded + /// + /// "Overloaded" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Overloaded"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: overloaded_error + /// + /// + /// Default Value: Overloaded + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaOverloadedError( + string message, + global::Anthropic.BetaOverloadedErrorType type = global::Anthropic.BetaOverloadedErrorType.OverloadedError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaOverloadedError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedErrorType.g.cs new file mode 100644 index 0000000..b1b8d32 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaOverloadedErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: overloaded_error + /// + public enum BetaOverloadedErrorType + { + /// + /// + /// + OverloadedError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaOverloadedErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaOverloadedErrorType value) + { + return value switch + { + BetaOverloadedErrorType.OverloadedError => "overloaded_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaOverloadedErrorType? ToEnum(string value) + { + return value switch + { + "overloaded_error" => BetaOverloadedErrorType.OverloadedError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionError.Json.g.cs new file mode 100644 index 0000000..d30fb35 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaPermissionError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaPermissionError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaPermissionError), + jsonSerializerContext) as global::Anthropic.BetaPermissionError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaPermissionError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaPermissionError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaPermissionError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionError.g.cs new file mode 100644 index 0000000..be98c3d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaPermissionError + { + /// + /// Default Value: permission_error + /// + /// global::Anthropic.BetaPermissionErrorType.PermissionError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaPermissionErrorTypeJsonConverter))] + public global::Anthropic.BetaPermissionErrorType Type { get; set; } = global::Anthropic.BetaPermissionErrorType.PermissionError; + + /// + /// Default Value: Permission denied + /// + /// "Permission denied" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Permission denied"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: permission_error + /// + /// + /// Default Value: Permission denied + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaPermissionError( + string message, + global::Anthropic.BetaPermissionErrorType type = global::Anthropic.BetaPermissionErrorType.PermissionError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaPermissionError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionErrorType.g.cs new file mode 100644 index 0000000..5e5ca39 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaPermissionErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: permission_error + /// + public enum BetaPermissionErrorType + { + /// + /// + /// + PermissionError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaPermissionErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaPermissionErrorType value) + { + return value switch + { + BetaPermissionErrorType.PermissionError => "permission_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaPermissionErrorType? ToEnum(string value) + { + return value switch + { + "permission_error" => BetaPermissionErrorType.PermissionError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitError.Json.g.cs new file mode 100644 index 0000000..5862c8a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRateLimitError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRateLimitError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRateLimitError), + jsonSerializerContext) as global::Anthropic.BetaRateLimitError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRateLimitError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRateLimitError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRateLimitError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitError.g.cs new file mode 100644 index 0000000..6235499 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRateLimitError + { + /// + /// Default Value: rate_limit_error + /// + /// global::Anthropic.BetaRateLimitErrorType.RateLimitError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRateLimitErrorTypeJsonConverter))] + public global::Anthropic.BetaRateLimitErrorType Type { get; set; } = global::Anthropic.BetaRateLimitErrorType.RateLimitError; + + /// + /// Default Value: Rate limited + /// + /// "Rate limited" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Rate limited"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: rate_limit_error + /// + /// + /// Default Value: Rate limited + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRateLimitError( + string message, + global::Anthropic.BetaRateLimitErrorType type = global::Anthropic.BetaRateLimitErrorType.RateLimitError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRateLimitError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitErrorType.g.cs new file mode 100644 index 0000000..0b7dd5e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRateLimitErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: rate_limit_error + /// + public enum BetaRateLimitErrorType + { + /// + /// + /// + RateLimitError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRateLimitErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRateLimitErrorType value) + { + return value switch + { + BetaRateLimitErrorType.RateLimitError => "rate_limit_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRateLimitErrorType? ToEnum(string value) + { + return value switch + { + "rate_limit_error" => BetaRateLimitErrorType.RateLimitError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestCounts.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestCounts.Json.g.cs new file mode 100644 index 0000000..fb98755 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestCounts.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestCounts + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestCounts? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestCounts), + jsonSerializerContext) as global::Anthropic.BetaRequestCounts; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestCounts? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestCounts), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestCounts; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchRequestCounts.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestCounts.g.cs similarity index 54% rename from src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchRequestCounts.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestCounts.g.cs index baed935..e594a2f 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatchRequestCounts.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestCounts.g.cs @@ -4,44 +4,68 @@ namespace Anthropic { /// - /// Tallies requests within the Message Batch, categorized by their status. + /// /// - public sealed partial class MessageBatchRequestCounts + public sealed partial class BetaRequestCounts { /// - /// Number of requests in the Message Batch that are processing. + /// Number of requests in the Message Batch that are processing.
+ /// Default Value: 0
+ /// Example: 100 ///
+ /// 0 + /// 100 [global::System.Text.Json.Serialization.JsonPropertyName("processing")] [global::System.Text.Json.Serialization.JsonRequired] - public required int Processing { get; set; } + public required int Processing { get; set; } = 0; /// - /// Number of requests in the Message Batch that have completed successfully. + /// Number of requests in the Message Batch that have completed successfully.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 50 ///
+ /// 0 + /// 50 [global::System.Text.Json.Serialization.JsonPropertyName("succeeded")] [global::System.Text.Json.Serialization.JsonRequired] - public required int Succeeded { get; set; } + public required int Succeeded { get; set; } = 0; /// - /// Number of requests in the Message Batch that encountered an error. + /// Number of requests in the Message Batch that encountered an error.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 30 ///
+ /// 0 + /// 30 [global::System.Text.Json.Serialization.JsonPropertyName("errored")] [global::System.Text.Json.Serialization.JsonRequired] - public required int Errored { get; set; } + public required int Errored { get; set; } = 0; /// - /// Number of requests in the Message Batch that have been canceled. + /// Number of requests in the Message Batch that have been canceled.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 10 ///
+ /// 0 + /// 10 [global::System.Text.Json.Serialization.JsonPropertyName("canceled")] [global::System.Text.Json.Serialization.JsonRequired] - public required int Canceled { get; set; } + public required int Canceled { get; set; } = 0; /// - /// Number of requests in the Message Batch that have expired. + /// Number of requests in the Message Batch that have expired.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 10 ///
+ /// 0 + /// 10 [global::System.Text.Json.Serialization.JsonPropertyName("expired")] [global::System.Text.Json.Serialization.JsonRequired] - public required int Expired { get; set; } + public required int Expired { get; set; } = 0; /// /// Additional properties that are not explicitly defined in the schema @@ -50,25 +74,39 @@ public sealed partial class MessageBatchRequestCounts public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// Number of requests in the Message Batch that are processing. + /// Number of requests in the Message Batch that are processing.
+ /// Default Value: 0
+ /// Example: 100 /// /// - /// Number of requests in the Message Batch that have completed successfully. + /// Number of requests in the Message Batch that have completed successfully.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 50 /// /// - /// Number of requests in the Message Batch that encountered an error. + /// Number of requests in the Message Batch that encountered an error.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 30 /// /// - /// Number of requests in the Message Batch that have been canceled. + /// Number of requests in the Message Batch that have been canceled.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 10 /// /// - /// Number of requests in the Message Batch that have expired. + /// Number of requests in the Message Batch that have expired.
+ /// This is zero until processing of the entire Message Batch has ended.
+ /// Default Value: 0
+ /// Example: 10 /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public MessageBatchRequestCounts( + public BetaRequestCounts( int processing, int succeeded, int errored, @@ -83,9 +121,9 @@ public MessageBatchRequestCounts( } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public MessageBatchRequestCounts() + public BetaRequestCounts() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlock.Json.g.cs new file mode 100644 index 0000000..4d216de --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestImageBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestImageBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestImageBlock), + jsonSerializerContext) as global::Anthropic.BetaRequestImageBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestImageBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestImageBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestImageBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlock.g.cs new file mode 100644 index 0000000..4c8dd55 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlock.g.cs @@ -0,0 +1,61 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestImageBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockTypeJsonConverter))] + public global::Anthropic.BetaRequestImageBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("source")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaBase64ImageSource Source { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestImageBlock( + global::Anthropic.BetaBase64ImageSource source, + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaRequestImageBlockType type) + { + this.Source = source ?? throw new global::System.ArgumentNullException(nameof(source)); + this.CacheControl = cacheControl; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestImageBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..1396a8d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestImageBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestImageBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestImageBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaRequestImageBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestImageBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestImageBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestImageBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..dfd1c37 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestImageBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestImageBlockCacheControlDiscriminator( + global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestImageBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..0c3f34c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestImageBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestImageBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestImageBlockCacheControlDiscriminatorType value) + { + return value switch + { + BetaRequestImageBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestImageBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaRequestImageBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminator.Json.g.cs new file mode 100644 index 0000000..becd2de --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestImageBlockSourceDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestImageBlockSourceDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestImageBlockSourceDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaRequestImageBlockSourceDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestImageBlockSourceDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestImageBlockSourceDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestImageBlockSourceDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminator.g.cs new file mode 100644 index 0000000..6bad171 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestImageBlockSourceDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockSourceDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestImageBlockSourceDiscriminator( + global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestImageBlockSourceDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminatorType.g.cs new file mode 100644 index 0000000..7fb115a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockSourceDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestImageBlockSourceDiscriminatorType + { + /// + /// + /// + Base64, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestImageBlockSourceDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestImageBlockSourceDiscriminatorType value) + { + return value switch + { + BetaRequestImageBlockSourceDiscriminatorType.Base64 => "base64", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestImageBlockSourceDiscriminatorType? ToEnum(string value) + { + return value switch + { + "base64" => BetaRequestImageBlockSourceDiscriminatorType.Base64, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockType.g.cs similarity index 66% rename from src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockType.g.cs index 1f7fbc7..0752170 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlockType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestImageBlockType.g.cs @@ -4,10 +4,9 @@ namespace Anthropic { /// - /// The type of content block.
- /// Default Value: image + /// ///
- public enum ImageBlockType + public enum BetaRequestImageBlockType { /// /// @@ -18,27 +17,27 @@ public enum ImageBlockType /// /// Enum extensions to do fast conversions without the reflection. /// - public static class ImageBlockTypeExtensions + public static class BetaRequestImageBlockTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this ImageBlockType value) + public static string ToValueString(this BetaRequestImageBlockType value) { return value switch { - ImageBlockType.Image => "image", + BetaRequestImageBlockType.Image => "image", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static ImageBlockType? ToEnum(string value) + public static BetaRequestImageBlockType? ToEnum(string value) { return value switch { - "image" => ImageBlockType.Image, + "image" => BetaRequestImageBlockType.Image, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlock.Json.g.cs new file mode 100644 index 0000000..d2a5e5d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestPDFBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestPDFBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestPDFBlock), + jsonSerializerContext) as global::Anthropic.BetaRequestPDFBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestPDFBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestPDFBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestPDFBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlock.g.cs new file mode 100644 index 0000000..dd7f279 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlock.g.cs @@ -0,0 +1,61 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestPDFBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestPDFBlockTypeJsonConverter))] + public global::Anthropic.BetaRequestPDFBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("source")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaBase64PDFSource Source { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestPDFBlock( + global::Anthropic.BetaBase64PDFSource source, + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaRequestPDFBlockType type) + { + this.Source = source ?? throw new global::System.ArgumentNullException(nameof(source)); + this.CacheControl = cacheControl; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestPDFBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..91ae732 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestPDFBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..d862c51 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestPDFBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestPDFBlockCacheControlDiscriminator( + global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestPDFBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..c00f253 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestPDFBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestPDFBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestPDFBlockCacheControlDiscriminatorType value) + { + return value switch + { + BetaRequestPDFBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestPDFBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaRequestPDFBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockType.g.cs new file mode 100644 index 0000000..632fd8d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestPDFBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestPDFBlockType + { + /// + /// + /// + Document, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestPDFBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestPDFBlockType value) + { + return value switch + { + BetaRequestPDFBlockType.Document => "document", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestPDFBlockType? ToEnum(string value) + { + return value switch + { + "document" => BetaRequestPDFBlockType.Document, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlock.Json.g.cs new file mode 100644 index 0000000..f9aec1e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestTextBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestTextBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestTextBlock), + jsonSerializerContext) as global::Anthropic.BetaRequestTextBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestTextBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestTextBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestTextBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlock.g.cs new file mode 100644 index 0000000..2fa860d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlock.g.cs @@ -0,0 +1,61 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestTextBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestTextBlockTypeJsonConverter))] + public global::Anthropic.BetaRequestTextBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Text { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestTextBlock( + string text, + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaRequestTextBlockType type) + { + this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); + this.CacheControl = cacheControl; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestTextBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..096bc6f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestTextBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestTextBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestTextBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaRequestTextBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestTextBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestTextBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestTextBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..07d3277 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestTextBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestTextBlockCacheControlDiscriminator( + global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestTextBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..b95e41d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestTextBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestTextBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestTextBlockCacheControlDiscriminatorType value) + { + return value switch + { + BetaRequestTextBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestTextBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaRequestTextBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockType.g.cs new file mode 100644 index 0000000..6503cd1 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestTextBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestTextBlockType + { + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestTextBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestTextBlockType value) + { + return value switch + { + BetaRequestTextBlockType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestTextBlockType? ToEnum(string value) + { + return value switch + { + "text" => BetaRequestTextBlockType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlock.Json.g.cs new file mode 100644 index 0000000..05d7dc6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestToolResultBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestToolResultBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestToolResultBlock), + jsonSerializerContext) as global::Anthropic.BetaRequestToolResultBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestToolResultBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestToolResultBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestToolResultBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlock.g.cs new file mode 100644 index 0000000..b9680a8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlock.g.cs @@ -0,0 +1,82 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestToolResultBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockTypeJsonConverter))] + public global::Anthropic.BetaRequestToolResultBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_use_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string ToolUseId { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("is_error")] + public bool? IsError { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? Content { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestToolResultBlock( + string toolUseId, + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaRequestToolResultBlockType type, + bool? isError, + global::Anthropic.AnyOf>? content) + { + this.ToolUseId = toolUseId ?? throw new global::System.ArgumentNullException(nameof(toolUseId)); + this.CacheControl = cacheControl; + this.Type = type; + this.IsError = isError; + this.Content = content; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestToolResultBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..936a6dd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestToolResultBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..18c1762 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestToolResultBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestToolResultBlockCacheControlDiscriminator( + global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestToolResultBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..7d13851 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestToolResultBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestToolResultBlockCacheControlDiscriminatorType value) + { + return value switch + { + BetaRequestToolResultBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestToolResultBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaRequestToolResultBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs new file mode 100644 index 0000000..ed0686d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestToolResultBlockContentVariant2ItemDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminator.g.cs new file mode 100644 index 0000000..8d64c2b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestToolResultBlockContentVariant2ItemDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestToolResultBlockContentVariant2ItemDiscriminator( + global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestToolResultBlockContentVariant2ItemDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..71b19e0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType + { + /// + /// + /// + Image, + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType value) + { + return value switch + { + BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Image => "image", + BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? ToEnum(string value) + { + return value switch + { + "image" => BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Image, + "text" => BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockType.g.cs similarity index 63% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlockType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockType.g.cs index bf4e924..2e02023 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlockType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolResultBlockType.g.cs @@ -4,10 +4,9 @@ namespace Anthropic { /// - /// The type of content block.
- /// Default Value: tool_result + /// ///
- public enum ToolResultBlockType + public enum BetaRequestToolResultBlockType { /// /// @@ -18,27 +17,27 @@ public enum ToolResultBlockType /// /// Enum extensions to do fast conversions without the reflection. /// - public static class ToolResultBlockTypeExtensions + public static class BetaRequestToolResultBlockTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this ToolResultBlockType value) + public static string ToValueString(this BetaRequestToolResultBlockType value) { return value switch { - ToolResultBlockType.ToolResult => "tool_result", + BetaRequestToolResultBlockType.ToolResult => "tool_result", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static ToolResultBlockType? ToEnum(string value) + public static BetaRequestToolResultBlockType? ToEnum(string value) { return value switch { - "tool_result" => ToolResultBlockType.ToolResult, + "tool_result" => BetaRequestToolResultBlockType.ToolResult, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlock.Json.g.cs new file mode 100644 index 0000000..842473c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestToolUseBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestToolUseBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestToolUseBlock), + jsonSerializerContext) as global::Anthropic.BetaRequestToolUseBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestToolUseBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestToolUseBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestToolUseBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlock.g.cs new file mode 100644 index 0000000..e3a4d3f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlock.g.cs @@ -0,0 +1,81 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestToolUseBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestToolUseBlockTypeJsonConverter))] + public global::Anthropic.BetaRequestToolUseBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("input")] + [global::System.Text.Json.Serialization.JsonRequired] + public required object Input { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestToolUseBlock( + string id, + string name, + object input, + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaRequestToolUseBlockType type) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Input = input ?? throw new global::System.ArgumentNullException(nameof(input)); + this.CacheControl = cacheControl; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestToolUseBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..2a94d1d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestToolUseBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..1c643a2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaRequestToolUseBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaRequestToolUseBlockCacheControlDiscriminator( + global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaRequestToolUseBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..f940ad2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestToolUseBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestToolUseBlockCacheControlDiscriminatorType value) + { + return value switch + { + BetaRequestToolUseBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestToolUseBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaRequestToolUseBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockInput.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockInput.Json.g.cs new file mode 100644 index 0000000..ea9b474 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockInput.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaRequestToolUseBlockInput + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaRequestToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaRequestToolUseBlockInput), + jsonSerializerContext) as global::Anthropic.BetaRequestToolUseBlockInput; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaRequestToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaRequestToolUseBlockInput), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaRequestToolUseBlockInput; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustomInputSchema.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockInput.g.cs similarity index 61% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolCustomInputSchema.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockInput.g.cs index 645eee2..e9dea70 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustomInputSchema.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockInput.g.cs @@ -4,11 +4,9 @@ namespace Anthropic { /// - /// [JSON schema](https://json-schema.org/) for this tool's input.
- /// This defines the shape of the `input` that your tool accepts and that the model
- /// will produce. + /// ///
- public sealed partial class ToolCustomInputSchema + public sealed partial class BetaRequestToolUseBlockInput { /// @@ -18,10 +16,10 @@ public sealed partial class ToolCustomInputSchema public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolCustomInputSchema( + public BetaRequestToolUseBlockInput( ) { } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockType.g.cs new file mode 100644 index 0000000..61671f2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaRequestToolUseBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaRequestToolUseBlockType + { + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaRequestToolUseBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaRequestToolUseBlockType value) + { + return value switch + { + BetaRequestToolUseBlockType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaRequestToolUseBlockType? ToEnum(string value) + { + return value switch + { + "tool_use" => BetaRequestToolUseBlockType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlock.Json.g.cs new file mode 100644 index 0000000..19fd585 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaResponseTextBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaResponseTextBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaResponseTextBlock), + jsonSerializerContext) as global::Anthropic.BetaResponseTextBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaResponseTextBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaResponseTextBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaResponseTextBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlock.g.cs new file mode 100644 index 0000000..750a99b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlock.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaResponseTextBlock + { + /// + /// Default Value: text + /// + /// global::Anthropic.BetaResponseTextBlockType.Text + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaResponseTextBlockTypeJsonConverter))] + public global::Anthropic.BetaResponseTextBlockType Type { get; set; } = global::Anthropic.BetaResponseTextBlockType.Text; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Text { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: text + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaResponseTextBlock( + string text, + global::Anthropic.BetaResponseTextBlockType type = global::Anthropic.BetaResponseTextBlockType.Text) + { + this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaResponseTextBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlockType.g.cs new file mode 100644 index 0000000..34bd195 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseTextBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: text + /// + public enum BetaResponseTextBlockType + { + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaResponseTextBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaResponseTextBlockType value) + { + return value switch + { + BetaResponseTextBlockType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaResponseTextBlockType? ToEnum(string value) + { + return value switch + { + "text" => BetaResponseTextBlockType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlock.Json.g.cs new file mode 100644 index 0000000..5c81feb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaResponseToolUseBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaResponseToolUseBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaResponseToolUseBlock), + jsonSerializerContext) as global::Anthropic.BetaResponseToolUseBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaResponseToolUseBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaResponseToolUseBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaResponseToolUseBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlock.g.cs new file mode 100644 index 0000000..6abad47 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlock.g.cs @@ -0,0 +1,75 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaResponseToolUseBlock + { + /// + /// Default Value: tool_use + /// + /// global::Anthropic.BetaResponseToolUseBlockType.ToolUse + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaResponseToolUseBlockTypeJsonConverter))] + public global::Anthropic.BetaResponseToolUseBlockType Type { get; set; } = global::Anthropic.BetaResponseToolUseBlockType.ToolUse; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("input")] + [global::System.Text.Json.Serialization.JsonRequired] + public required object Input { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: tool_use + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaResponseToolUseBlock( + string id, + string name, + object input, + global::Anthropic.BetaResponseToolUseBlockType type = global::Anthropic.BetaResponseToolUseBlockType.ToolUse) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Input = input ?? throw new global::System.ArgumentNullException(nameof(input)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaResponseToolUseBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockInput.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockInput.Json.g.cs new file mode 100644 index 0000000..920c5e0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockInput.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaResponseToolUseBlockInput + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaResponseToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaResponseToolUseBlockInput), + jsonSerializerContext) as global::Anthropic.BetaResponseToolUseBlockInput; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaResponseToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaResponseToolUseBlockInput), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaResponseToolUseBlockInput; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockInput.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockInput.g.cs new file mode 100644 index 0000000..add9e77 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockInput.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaResponseToolUseBlockInput + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaResponseToolUseBlockInput( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockType.g.cs new file mode 100644 index 0000000..96ca485 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaResponseToolUseBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: tool_use + /// + public enum BetaResponseToolUseBlockType + { + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaResponseToolUseBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaResponseToolUseBlockType value) + { + return value switch + { + BetaResponseToolUseBlockType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaResponseToolUseBlockType? ToEnum(string value) + { + return value switch + { + "tool_use" => BetaResponseToolUseBlockType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResult.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResult.Json.g.cs new file mode 100644 index 0000000..3a1a630 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResult.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaSucceededResult + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaSucceededResult? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaSucceededResult), + jsonSerializerContext) as global::Anthropic.BetaSucceededResult; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaSucceededResult? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaSucceededResult), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaSucceededResult; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResult.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResult.g.cs new file mode 100644 index 0000000..06cb37d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResult.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaSucceededResult + { + /// + /// Default Value: succeeded + /// + /// global::Anthropic.BetaSucceededResultType.Succeeded + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaSucceededResultTypeJsonConverter))] + public global::Anthropic.BetaSucceededResultType Type { get; set; } = global::Anthropic.BetaSucceededResultType.Succeeded; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaMessage Message { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: succeeded + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaSucceededResult( + global::Anthropic.BetaMessage message, + global::Anthropic.BetaSucceededResultType type = global::Anthropic.BetaSucceededResultType.Succeeded) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaSucceededResult() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResultType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResultType.g.cs new file mode 100644 index 0000000..4711b50 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaSucceededResultType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: succeeded + /// + public enum BetaSucceededResultType + { + /// + /// + /// + Succeeded, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaSucceededResultTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaSucceededResultType value) + { + return value switch + { + BetaSucceededResultType.Succeeded => "succeeded", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaSucceededResultType? ToEnum(string value) + { + return value switch + { + "succeeded" => BetaSucceededResultType.Succeeded, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDelta.Json.g.cs new file mode 100644 index 0000000..25023ae --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDelta.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaTextContentBlockDelta + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaTextContentBlockDelta? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaTextContentBlockDelta), + jsonSerializerContext) as global::Anthropic.BetaTextContentBlockDelta; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaTextContentBlockDelta? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaTextContentBlockDelta), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaTextContentBlockDelta; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDelta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDelta.g.cs new file mode 100644 index 0000000..b849d59 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDelta.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaTextContentBlockDelta + { + /// + /// Default Value: text_delta + /// + /// global::Anthropic.BetaTextContentBlockDeltaType.TextDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaTextContentBlockDeltaTypeJsonConverter))] + public global::Anthropic.BetaTextContentBlockDeltaType Type { get; set; } = global::Anthropic.BetaTextContentBlockDeltaType.TextDelta; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Text { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: text_delta + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaTextContentBlockDelta( + string text, + global::Anthropic.BetaTextContentBlockDeltaType type = global::Anthropic.BetaTextContentBlockDeltaType.TextDelta) + { + this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaTextContentBlockDelta() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDeltaType.g.cs new file mode 100644 index 0000000..e318ef5 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextContentBlockDeltaType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: text_delta + /// + public enum BetaTextContentBlockDeltaType + { + /// + /// + /// + TextDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaTextContentBlockDeltaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaTextContentBlockDeltaType value) + { + return value switch + { + BetaTextContentBlockDeltaType.TextDelta => "text_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaTextContentBlockDeltaType? ToEnum(string value) + { + return value switch + { + "text_delta" => BetaTextContentBlockDeltaType.TextDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022.Json.g.cs new file mode 100644 index 0000000..e2c8f44 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaTextEditor20241022 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaTextEditor20241022? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaTextEditor20241022), + jsonSerializerContext) as global::Anthropic.BetaTextEditor20241022; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaTextEditor20241022? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaTextEditor20241022), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaTextEditor20241022; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022.g.cs new file mode 100644 index 0000000..8af9aaf --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022.g.cs @@ -0,0 +1,65 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaTextEditor20241022 + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022TypeJsonConverter))] + public global::Anthropic.BetaTextEditor20241022Type Type { get; set; } + + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022NameJsonConverter))] + public global::Anthropic.BetaTextEditor20241022Name Name { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaTextEditor20241022( + global::Anthropic.BetaCacheControlEphemeral? cacheControl, + global::Anthropic.BetaTextEditor20241022Type type, + global::Anthropic.BetaTextEditor20241022Name name) + { + this.CacheControl = cacheControl; + this.Type = type; + this.Name = name; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaTextEditor20241022() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..f515748 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaTextEditor20241022CacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaTextEditor20241022CacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaTextEditor20241022CacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaTextEditor20241022CacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaTextEditor20241022CacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaTextEditor20241022CacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaTextEditor20241022CacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminator.g.cs new file mode 100644 index 0000000..0ad9fdb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaTextEditor20241022CacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaTextEditor20241022CacheControlDiscriminator( + global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaTextEditor20241022CacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..03e2e50 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022CacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaTextEditor20241022CacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaTextEditor20241022CacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaTextEditor20241022CacheControlDiscriminatorType value) + { + return value switch + { + BetaTextEditor20241022CacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaTextEditor20241022CacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaTextEditor20241022CacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022Name.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022Name.g.cs new file mode 100644 index 0000000..1e15233 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022Name.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + ///
+ public enum BetaTextEditor20241022Name + { + /// + /// + /// + StrReplaceEditor, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaTextEditor20241022NameExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaTextEditor20241022Name value) + { + return value switch + { + BetaTextEditor20241022Name.StrReplaceEditor => "str_replace_editor", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaTextEditor20241022Name? ToEnum(string value) + { + return value switch + { + "str_replace_editor" => BetaTextEditor20241022Name.StrReplaceEditor, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022Type.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022Type.g.cs new file mode 100644 index 0000000..fe3bd36 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTextEditor20241022Type.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaTextEditor20241022Type + { + /// + /// + /// + TextEditor20241022, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaTextEditor20241022TypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaTextEditor20241022Type value) + { + return value switch + { + BetaTextEditor20241022Type.TextEditor20241022 => "text_editor_20241022", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaTextEditor20241022Type? ToEnum(string value) + { + return value switch + { + "text_editor_20241022" => BetaTextEditor20241022Type.TextEditor20241022, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTool.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTool.Json.g.cs new file mode 100644 index 0000000..f664351 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTool.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaTool + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaTool? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaTool), + jsonSerializerContext) as global::Anthropic.BetaTool; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaTool? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaTool), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaTool; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaTool.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTool.g.cs new file mode 100644 index 0000000..6b889c0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaTool.g.cs @@ -0,0 +1,95 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaTool + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolTypeJsonConverter))] + public global::Anthropic.BetaToolType? Type { get; set; } + + /// + /// Description of what this tool does.
+ /// Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
+ /// Example: Get the current weather in a given location + ///
+ /// Get the current weather in a given location + [global::System.Text.Json.Serialization.JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// [JSON schema](https://json-schema.org/) for this tool's input.
+ /// This defines the shape of the `input` that your tool accepts and that the model will produce. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("input_schema")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.BetaInputSchema InputSchema { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.BetaCacheControlEphemeral? CacheControl { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// Description of what this tool does.
+ /// Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
+ /// Example: Get the current weather in a given location + /// + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + /// + /// + /// [JSON schema](https://json-schema.org/) for this tool's input.
+ /// This defines the shape of the `input` that your tool accepts and that the model will produce. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaTool( + string name, + global::Anthropic.BetaInputSchema inputSchema, + global::Anthropic.BetaToolType? type, + string? description, + global::Anthropic.BetaCacheControlEphemeral? cacheControl) + { + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.InputSchema = inputSchema ?? throw new global::System.ArgumentNullException(nameof(inputSchema)); + this.Type = type; + this.Description = description; + this.CacheControl = cacheControl; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaTool() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..447eaa7 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaToolCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaToolCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaToolCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaToolCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaToolCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaToolCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaToolCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..622d45a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaToolCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaToolCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaToolCacheControlDiscriminator( + global::Anthropic.BetaToolCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaToolCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..823ee0e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaToolCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaToolCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaToolCacheControlDiscriminatorType value) + { + return value switch + { + BetaToolCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaToolCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => BetaToolCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoice.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoice.Json.g.cs new file mode 100644 index 0000000..88597ff --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoice.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct BetaToolChoice + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaToolChoice? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaToolChoice), + jsonSerializerContext) as global::Anthropic.BetaToolChoice?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaToolChoice? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaToolChoice), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaToolChoice?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoice.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoice.g.cs new file mode 100644 index 0000000..42ff1fa --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoice.g.cs @@ -0,0 +1,273 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + public readonly partial struct BetaToolChoice : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaToolChoiceDiscriminatorType? Type { get; } + + /// + /// The model will automatically decide whether to use tools. + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaToolChoiceAuto? Auto { get; init; } +#else + public global::Anthropic.BetaToolChoiceAuto? Auto { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Auto))] +#endif + public bool IsAuto => Auto != null; + + /// + /// + /// + public static implicit operator BetaToolChoice(global::Anthropic.BetaToolChoiceAuto value) => new BetaToolChoice(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaToolChoiceAuto?(BetaToolChoice @this) => @this.Auto; + + /// + /// + /// + public BetaToolChoice(global::Anthropic.BetaToolChoiceAuto? value) + { + Auto = value; + } + + /// + /// The model will use any available tools. + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaToolChoiceAny? Any { get; init; } +#else + public global::Anthropic.BetaToolChoiceAny? Any { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Any))] +#endif + public bool IsAny => Any != null; + + /// + /// + /// + public static implicit operator BetaToolChoice(global::Anthropic.BetaToolChoiceAny value) => new BetaToolChoice(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaToolChoiceAny?(BetaToolChoice @this) => @this.Any; + + /// + /// + /// + public BetaToolChoice(global::Anthropic.BetaToolChoiceAny? value) + { + Any = value; + } + + /// + /// The model will use the specified tool with `tool_choice.name`. + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaToolChoiceTool? Tool { get; init; } +#else + public global::Anthropic.BetaToolChoiceTool? Tool { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Tool))] +#endif + public bool IsTool => Tool != null; + + /// + /// + /// + public static implicit operator BetaToolChoice(global::Anthropic.BetaToolChoiceTool value) => new BetaToolChoice(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaToolChoiceTool?(BetaToolChoice @this) => @this.Tool; + + /// + /// + /// + public BetaToolChoice(global::Anthropic.BetaToolChoiceTool? value) + { + Tool = value; + } + + /// + /// + /// + public BetaToolChoice( + global::Anthropic.BetaToolChoiceDiscriminatorType? type, + global::Anthropic.BetaToolChoiceAuto? auto, + global::Anthropic.BetaToolChoiceAny? any, + global::Anthropic.BetaToolChoiceTool? tool + ) + { + Type = type; + + Auto = auto; + Any = any; + Tool = tool; + } + + /// + /// + /// + public object? Object => + Tool as object ?? + Any as object ?? + Auto as object + ; + + /// + /// + /// + public bool Validate() + { + return IsAuto && !IsAny && !IsTool || !IsAuto && IsAny && !IsTool || !IsAuto && !IsAny && IsTool; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? auto = null, + global::System.Func? any = null, + global::System.Func? tool = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsAuto && auto != null) + { + return auto(Auto!); + } + else if (IsAny && any != null) + { + return any(Any!); + } + else if (IsTool && tool != null) + { + return tool(Tool!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? auto = null, + global::System.Action? any = null, + global::System.Action? tool = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsAuto) + { + auto?.Invoke(Auto!); + } + else if (IsAny) + { + any?.Invoke(Any!); + } + else if (IsTool) + { + tool?.Invoke(Tool!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Auto, + typeof(global::Anthropic.BetaToolChoiceAuto), + Any, + typeof(global::Anthropic.BetaToolChoiceAny), + Tool, + typeof(global::Anthropic.BetaToolChoiceTool), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(BetaToolChoice other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Auto, other.Auto) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Any, other.Any) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Tool, other.Tool) + ; + } + + /// + /// + /// + public static bool operator ==(BetaToolChoice obj1, BetaToolChoice obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(BetaToolChoice obj1, BetaToolChoice obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is BetaToolChoice o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAny.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAny.Json.g.cs new file mode 100644 index 0000000..b8905db --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAny.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaToolChoiceAny + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaToolChoiceAny? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaToolChoiceAny), + jsonSerializerContext) as global::Anthropic.BetaToolChoiceAny; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaToolChoiceAny? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaToolChoiceAny), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaToolChoiceAny; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAny.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAny.g.cs new file mode 100644 index 0000000..48c37a9 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAny.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The model will use any available tools. + /// + public sealed partial class BetaToolChoiceAny + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolChoiceAnyTypeJsonConverter))] + public global::Anthropic.BetaToolChoiceAnyType Type { get; set; } + + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("disable_parallel_tool_use")] + public bool? DisableParallelToolUse { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaToolChoiceAny( + global::Anthropic.BetaToolChoiceAnyType type, + bool? disableParallelToolUse) + { + this.Type = type; + this.DisableParallelToolUse = disableParallelToolUse; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaToolChoiceAny() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAnyType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAnyType.g.cs new file mode 100644 index 0000000..bcd3e63 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAnyType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaToolChoiceAnyType + { + /// + /// + /// + Any, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaToolChoiceAnyTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaToolChoiceAnyType value) + { + return value switch + { + BetaToolChoiceAnyType.Any => "any", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaToolChoiceAnyType? ToEnum(string value) + { + return value switch + { + "any" => BetaToolChoiceAnyType.Any, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAuto.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAuto.Json.g.cs new file mode 100644 index 0000000..1c2387b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAuto.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaToolChoiceAuto + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaToolChoiceAuto? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaToolChoiceAuto), + jsonSerializerContext) as global::Anthropic.BetaToolChoiceAuto; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaToolChoiceAuto? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaToolChoiceAuto), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaToolChoiceAuto; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAuto.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAuto.g.cs new file mode 100644 index 0000000..5b990b5 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAuto.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The model will automatically decide whether to use tools. + /// + public sealed partial class BetaToolChoiceAuto + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolChoiceAutoTypeJsonConverter))] + public global::Anthropic.BetaToolChoiceAutoType Type { get; set; } + + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output at most one tool use. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("disable_parallel_tool_use")] + public bool? DisableParallelToolUse { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output at most one tool use. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaToolChoiceAuto( + global::Anthropic.BetaToolChoiceAutoType type, + bool? disableParallelToolUse) + { + this.Type = type; + this.DisableParallelToolUse = disableParallelToolUse; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaToolChoiceAuto() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAutoType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAutoType.g.cs new file mode 100644 index 0000000..3bbeb7f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceAutoType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaToolChoiceAutoType + { + /// + /// + /// + Auto, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaToolChoiceAutoTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaToolChoiceAutoType value) + { + return value switch + { + BetaToolChoiceAutoType.Auto => "auto", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaToolChoiceAutoType? ToEnum(string value) + { + return value switch + { + "auto" => BetaToolChoiceAutoType.Auto, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminator.Json.g.cs new file mode 100644 index 0000000..fbfcb67 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaToolChoiceDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaToolChoiceDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaToolChoiceDiscriminator), + jsonSerializerContext) as global::Anthropic.BetaToolChoiceDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaToolChoiceDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaToolChoiceDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaToolChoiceDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminator.g.cs new file mode 100644 index 0000000..6c3a8f7 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaToolChoiceDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolChoiceDiscriminatorTypeJsonConverter))] + public global::Anthropic.BetaToolChoiceDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaToolChoiceDiscriminator( + global::Anthropic.BetaToolChoiceDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaToolChoiceDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminatorType.g.cs new file mode 100644 index 0000000..f9d1644 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceDiscriminatorType.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaToolChoiceDiscriminatorType + { + /// + /// + /// + Any, + /// + /// + /// + Auto, + /// + /// + /// + Tool, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaToolChoiceDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaToolChoiceDiscriminatorType value) + { + return value switch + { + BetaToolChoiceDiscriminatorType.Any => "any", + BetaToolChoiceDiscriminatorType.Auto => "auto", + BetaToolChoiceDiscriminatorType.Tool => "tool", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaToolChoiceDiscriminatorType? ToEnum(string value) + { + return value switch + { + "any" => BetaToolChoiceDiscriminatorType.Any, + "auto" => BetaToolChoiceDiscriminatorType.Auto, + "tool" => BetaToolChoiceDiscriminatorType.Tool, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceTool.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceTool.Json.g.cs new file mode 100644 index 0000000..10fbc36 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceTool.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaToolChoiceTool + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaToolChoiceTool? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaToolChoiceTool), + jsonSerializerContext) as global::Anthropic.BetaToolChoiceTool; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaToolChoiceTool? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaToolChoiceTool), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaToolChoiceTool; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceTool.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceTool.g.cs new file mode 100644 index 0000000..ce2198b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceTool.g.cs @@ -0,0 +1,67 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The model will use the specified tool with `tool_choice.name`. + /// + public sealed partial class BetaToolChoiceTool + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BetaToolChoiceToolTypeJsonConverter))] + public global::Anthropic.BetaToolChoiceToolType Type { get; set; } + + /// + /// The name of the tool to use. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("disable_parallel_tool_use")] + public bool? DisableParallelToolUse { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// The name of the tool to use. + /// + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaToolChoiceTool( + string name, + global::Anthropic.BetaToolChoiceToolType type, + bool? disableParallelToolUse) + { + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Type = type; + this.DisableParallelToolUse = disableParallelToolUse; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaToolChoiceTool() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceToolType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceToolType.g.cs new file mode 100644 index 0000000..5719584 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolChoiceToolType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaToolChoiceToolType + { + /// + /// + /// + Tool, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaToolChoiceToolTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaToolChoiceToolType value) + { + return value switch + { + BetaToolChoiceToolType.Tool => "tool", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaToolChoiceToolType? ToEnum(string value) + { + return value switch + { + "tool" => BetaToolChoiceToolType.Tool, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolType.g.cs new file mode 100644 index 0000000..e770729 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaToolType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum BetaToolType + { + /// + /// + /// + Custom, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class BetaToolTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this BetaToolType value) + { + return value switch + { + BetaToolType.Custom => "custom", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static BetaToolType? ToEnum(string value) + { + return value switch + { + "custom" => BetaToolType.Custom, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaUsage.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaUsage.Json.g.cs new file mode 100644 index 0000000..f69aec3 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaUsage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class BetaUsage + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.BetaUsage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.BetaUsage), + jsonSerializerContext) as global::Anthropic.BetaUsage; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.BetaUsage? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.BetaUsage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.BetaUsage; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BetaUsage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.BetaUsage.g.cs new file mode 100644 index 0000000..8cadc82 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.BetaUsage.g.cs @@ -0,0 +1,92 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class BetaUsage + { + /// + /// The number of input tokens which were used.
+ /// Example: 2095 + ///
+ /// 2095 + [global::System.Text.Json.Serialization.JsonPropertyName("input_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int InputTokens { get; set; } + + /// + /// The number of input tokens used to create the cache entry.
+ /// Example: 2051 + ///
+ /// 2051 + [global::System.Text.Json.Serialization.JsonPropertyName("cache_creation_input_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int? CacheCreationInputTokens { get; set; } + + /// + /// The number of input tokens read from the cache.
+ /// Example: 2051 + ///
+ /// 2051 + [global::System.Text.Json.Serialization.JsonPropertyName("cache_read_input_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int? CacheReadInputTokens { get; set; } + + /// + /// The number of output tokens which were used.
+ /// Example: 503 + ///
+ /// 503 + [global::System.Text.Json.Serialization.JsonPropertyName("output_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int OutputTokens { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The number of input tokens which were used.
+ /// Example: 2095 + /// + /// + /// The number of input tokens used to create the cache entry.
+ /// Example: 2051 + /// + /// + /// The number of input tokens read from the cache.
+ /// Example: 2051 + /// + /// + /// The number of output tokens which were used.
+ /// Example: 503 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BetaUsage( + int inputTokens, + int? cacheCreationInputTokens, + int? cacheReadInputTokens, + int outputTokens) + { + this.InputTokens = inputTokens; + this.CacheCreationInputTokens = cacheCreationInputTokens; + this.CacheReadInputTokens = cacheReadInputTokens; + this.OutputTokens = outputTokens; + } + + /// + /// Initializes a new instance of the class. + /// + public BetaUsage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeral.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeral.g.cs index eff004b..38ea35d 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeral.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeral.g.cs @@ -4,16 +4,16 @@ namespace Anthropic { /// - /// The cache control settings. + /// /// public sealed partial class CacheControlEphemeral { /// - /// Default Value: ephemeral + /// /// [global::System.Text.Json.Serialization.JsonPropertyName("type")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.CacheControlEphemeralTypeJsonConverter))] - public global::Anthropic.CacheControlEphemeralType? Type { get; set; } + public global::Anthropic.CacheControlEphemeralType Type { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -24,12 +24,10 @@ public sealed partial class CacheControlEphemeral /// /// Initializes a new instance of the class. /// - /// - /// Default Value: ephemeral - /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CacheControlEphemeral( - global::Anthropic.CacheControlEphemeralType? type) + global::Anthropic.CacheControlEphemeralType type) { this.Type = type; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeralType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeralType.g.cs index 03b3920..ebf6693 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeralType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeralType.g.cs @@ -4,7 +4,7 @@ namespace Anthropic { /// - /// Default Value: ephemeral + /// /// public enum CacheControlEphemeralType { diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CompletionRequest.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionRequest.Json.g.cs new file mode 100644 index 0000000..6e3e71e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class CompletionRequest + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.CompletionRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.CompletionRequest), + jsonSerializerContext) as global::Anthropic.CompletionRequest; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.CompletionRequest? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.CompletionRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.CompletionRequest; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CompletionRequest.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionRequest.g.cs new file mode 100644 index 0000000..2a6e9dd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionRequest.g.cs @@ -0,0 +1,185 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class CompletionRequest + { + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// The prompt that you want Claude to complete.
+ /// For proper response generation you will need to format your prompt using alternating `\n\nHuman:` and `\n\nAssistant:` conversational turns. For example:
+ /// ```
+ /// "\n\nHuman: {userQuestion}\n\nAssistant:"
+ /// ```
+ /// See [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more details.
+ /// Example:
+ /// Human: Hello, world!
+ /// Assistant: + ///
+ /// + /// Human: Hello, world!
+ /// Assistant: + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Prompt { get; set; } + + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Example: 256 + ///
+ /// 256 + [global::System.Text.Json.Serialization.JsonPropertyName("max_tokens_to_sample")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int MaxTokensToSample { get; set; } + + /// + /// Sequences that will cause the model to stop generating.
+ /// Our models stop on `"\n\nHuman:"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_sequences")] + public global::System.Collections.Generic.IList? StopSequences { get; set; } + + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + ///
+ /// 1 + [global::System.Text.Json.Serialization.JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + ///
+ /// 0.7 + [global::System.Text.Json.Serialization.JsonPropertyName("top_p")] + public double? TopP { get; set; } + + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + ///
+ /// 5 + [global::System.Text.Json.Serialization.JsonPropertyName("top_k")] + public int? TopK { get; set; } + + /// + /// An object describing metadata about the request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("metadata")] + public global::Anthropic.Metadata? Metadata { get; set; } + + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/streaming) for details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stream")] + public bool? Stream { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// The prompt that you want Claude to complete.
+ /// For proper response generation you will need to format your prompt using alternating `\n\nHuman:` and `\n\nAssistant:` conversational turns. For example:
+ /// ```
+ /// "\n\nHuman: {userQuestion}\n\nAssistant:"
+ /// ```
+ /// See [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more details.
+ /// Example:
+ /// Human: Hello, world!
+ /// Assistant: + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Example: 256 + /// + /// + /// Sequences that will cause the model to stop generating.
+ /// Our models stop on `"\n\nHuman:"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating. + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/streaming) for details. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionRequest( + global::Anthropic.Model model, + string prompt, + int maxTokensToSample, + global::System.Collections.Generic.IList? stopSequences, + double? temperature, + double? topP, + int? topK, + global::Anthropic.Metadata? metadata, + bool? stream) + { + this.Model = model; + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.MaxTokensToSample = maxTokensToSample; + this.StopSequences = stopSequences; + this.Temperature = temperature; + this.TopP = topP; + this.TopK = topK; + this.Metadata = metadata; + this.Stream = stream; + } + + /// + /// Initializes a new instance of the class. + /// + public CompletionRequest() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponse.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponse.Json.g.cs new file mode 100644 index 0000000..ea5f850 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class CompletionResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.CompletionResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.CompletionResponse), + jsonSerializerContext) as global::Anthropic.CompletionResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.CompletionResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.CompletionResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.CompletionResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponse.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponse.g.cs new file mode 100644 index 0000000..fa5fb48 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponse.g.cs @@ -0,0 +1,112 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class CompletionResponse + { + /// + /// Object type.
+ /// For Text Completions, this is always `"completion"`.
+ /// Default Value: completion + ///
+ /// global::Anthropic.CompletionResponseType.Completion + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.CompletionResponseTypeJsonConverter))] + public global::Anthropic.CompletionResponseType Type { get; set; } = global::Anthropic.CompletionResponseType.Completion; + + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// The resulting completion up to and excluding the stop sequences.
+ /// Example: Hello! My name is Claude. + ///
+ /// Hello! My name is Claude. + [global::System.Text.Json.Serialization.JsonPropertyName("completion")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Completion { get; set; } + + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model
+ /// * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum
+ /// Example: stop_sequence + ///
+ /// stop_sequence + [global::System.Text.Json.Serialization.JsonPropertyName("stop_reason")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string? StopReason { get; set; } + + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Object type.
+ /// For Text Completions, this is always `"completion"`.
+ /// Default Value: completion + /// + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time. + /// + /// + /// The resulting completion up to and excluding the stop sequences.
+ /// Example: Hello! My name is Claude. + /// + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model
+ /// * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum
+ /// Example: stop_sequence + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionResponse( + string id, + string completion, + string? stopReason, + global::Anthropic.Model model, + global::Anthropic.CompletionResponseType type = global::Anthropic.CompletionResponseType.Completion) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Completion = completion ?? throw new global::System.ArgumentNullException(nameof(completion)); + this.StopReason = stopReason ?? throw new global::System.ArgumentNullException(nameof(stopReason)); + this.Model = model; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public CompletionResponse() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponseType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponseType.g.cs new file mode 100644 index 0000000..a10095d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CompletionResponseType.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Object type.
+ /// For Text Completions, this is always `"completion"`.
+ /// Default Value: completion + ///
+ public enum CompletionResponseType + { + /// + /// + /// + Completion, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class CompletionResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this CompletionResponseType value) + { + return value switch + { + CompletionResponseType.Completion => "completion", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static CompletionResponseType? ToEnum(string value) + { + return value switch + { + "completion" => CompletionResponseType.Completion, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock.Json.g.cs new file mode 100644 index 0000000..bcda1ac --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentBlock), + jsonSerializerContext) as global::Anthropic.ContentBlock?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentBlock?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock.g.cs new file mode 100644 index 0000000..b62e7aa --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ContentBlock : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaResponseTextBlock? Text { get; init; } +#else + public global::Anthropic.BetaResponseTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator ContentBlock(global::Anthropic.BetaResponseTextBlock value) => new ContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaResponseTextBlock?(ContentBlock @this) => @this.Text; + + /// + /// + /// + public ContentBlock(global::Anthropic.BetaResponseTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaResponseToolUseBlock? ToolUse { get; init; } +#else + public global::Anthropic.BetaResponseToolUseBlock? ToolUse { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolUse))] +#endif + public bool IsToolUse => ToolUse != null; + + /// + /// + /// + public static implicit operator ContentBlock(global::Anthropic.BetaResponseToolUseBlock value) => new ContentBlock(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaResponseToolUseBlock?(ContentBlock @this) => @this.ToolUse; + + /// + /// + /// + public ContentBlock(global::Anthropic.BetaResponseToolUseBlock? value) + { + ToolUse = value; + } + + /// + /// + /// + public ContentBlock( + global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType? type, + global::Anthropic.BetaResponseTextBlock? text, + global::Anthropic.BetaResponseToolUseBlock? toolUse + ) + { + Type = type; + + Text = text; + ToolUse = toolUse; + } + + /// + /// + /// + public object? Object => + ToolUse as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsToolUse || !IsText && IsToolUse; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsToolUse && toolUse != null) + { + return toolUse(ToolUse!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsToolUse) + { + toolUse?.Invoke(ToolUse!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.BetaResponseTextBlock), + ToolUse, + typeof(global::Anthropic.BetaResponseToolUseBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ContentBlock other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) + ; + } + + /// + /// + /// + public static bool operator ==(ContentBlock obj1, ContentBlock obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ContentBlock obj1, ContentBlock obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ContentBlock o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock2.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock2.Json.g.cs new file mode 100644 index 0000000..acb2eb1 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentBlock2 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentBlock2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentBlock2), + jsonSerializerContext) as global::Anthropic.ContentBlock2?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentBlock2? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentBlock2), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentBlock2?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock2.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock2.g.cs new file mode 100644 index 0000000..f7e9562 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock2.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ContentBlock2 : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ResponseTextBlock? Text { get; init; } +#else + public global::Anthropic.ResponseTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator ContentBlock2(global::Anthropic.ResponseTextBlock value) => new ContentBlock2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ResponseTextBlock?(ContentBlock2 @this) => @this.Text; + + /// + /// + /// + public ContentBlock2(global::Anthropic.ResponseTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ResponseToolUseBlock? ToolUse { get; init; } +#else + public global::Anthropic.ResponseToolUseBlock? ToolUse { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolUse))] +#endif + public bool IsToolUse => ToolUse != null; + + /// + /// + /// + public static implicit operator ContentBlock2(global::Anthropic.ResponseToolUseBlock value) => new ContentBlock2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ResponseToolUseBlock?(ContentBlock2 @this) => @this.ToolUse; + + /// + /// + /// + public ContentBlock2(global::Anthropic.ResponseToolUseBlock? value) + { + ToolUse = value; + } + + /// + /// + /// + public ContentBlock2( + global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType? type, + global::Anthropic.ResponseTextBlock? text, + global::Anthropic.ResponseToolUseBlock? toolUse + ) + { + Type = type; + + Text = text; + ToolUse = toolUse; + } + + /// + /// + /// + public object? Object => + ToolUse as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsToolUse || !IsText && IsToolUse; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsToolUse && toolUse != null) + { + return toolUse(ToolUse!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsToolUse) + { + toolUse?.Invoke(ToolUse!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.ResponseTextBlock), + ToolUse, + typeof(global::Anthropic.ResponseToolUseBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ContentBlock2 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) + ; + } + + /// + /// + /// + public static bool operator ==(ContentBlock2 obj1, ContentBlock2 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ContentBlock2 obj1, ContentBlock2 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ContentBlock2 o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock3.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock3.Json.g.cs new file mode 100644 index 0000000..631b2fc --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock3.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentBlock3 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentBlock3? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentBlock3), + jsonSerializerContext) as global::Anthropic.ContentBlock3?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentBlock3? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentBlock3), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentBlock3?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock3.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock3.g.cs new file mode 100644 index 0000000..c5ee812 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlock3.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ContentBlock3 : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.ContentBlockDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ResponseTextBlock? Text { get; init; } +#else + public global::Anthropic.ResponseTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator ContentBlock3(global::Anthropic.ResponseTextBlock value) => new ContentBlock3(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ResponseTextBlock?(ContentBlock3 @this) => @this.Text; + + /// + /// + /// + public ContentBlock3(global::Anthropic.ResponseTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ResponseToolUseBlock? ToolUse { get; init; } +#else + public global::Anthropic.ResponseToolUseBlock? ToolUse { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolUse))] +#endif + public bool IsToolUse => ToolUse != null; + + /// + /// + /// + public static implicit operator ContentBlock3(global::Anthropic.ResponseToolUseBlock value) => new ContentBlock3(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ResponseToolUseBlock?(ContentBlock3 @this) => @this.ToolUse; + + /// + /// + /// + public ContentBlock3(global::Anthropic.ResponseToolUseBlock? value) + { + ToolUse = value; + } + + /// + /// + /// + public ContentBlock3( + global::Anthropic.ContentBlockDiscriminatorType? type, + global::Anthropic.ResponseTextBlock? text, + global::Anthropic.ResponseToolUseBlock? toolUse + ) + { + Type = type; + + Text = text; + ToolUse = toolUse; + } + + /// + /// + /// + public object? Object => + ToolUse as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsToolUse || !IsText && IsToolUse; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsToolUse && toolUse != null) + { + return toolUse(ToolUse!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? toolUse = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsToolUse) + { + toolUse?.Invoke(ToolUse!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.ResponseTextBlock), + ToolUse, + typeof(global::Anthropic.ResponseToolUseBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ContentBlock3 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) + ; + } + + /// + /// + /// + public static bool operator ==(ContentBlock3 obj1, ContentBlock3 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ContentBlock3 obj1, ContentBlock3 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ContentBlock3 o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEvent.g.cs index 09f370a..97b6d1e 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEvent.g.cs @@ -4,32 +4,32 @@ namespace Anthropic { /// - /// A delta event in a streaming content block. + /// /// public sealed partial class ContentBlockDeltaEvent { /// - /// A delta in a streaming message. + /// Default Value: content_block_delta /// - [global::System.Text.Json.Serialization.JsonPropertyName("delta")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BlockDeltaJsonConverter))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.BlockDelta Delta { get; set; } + /// global::Anthropic.ContentBlockDeltaEventType.ContentBlockDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlockDeltaEventTypeJsonConverter))] + public global::Anthropic.ContentBlockDeltaEventType Type { get; set; } = global::Anthropic.ContentBlockDeltaEventType.ContentBlockDelta; /// - /// The index of the content block. + /// /// [global::System.Text.Json.Serialization.JsonPropertyName("index")] [global::System.Text.Json.Serialization.JsonRequired] public required int Index { get; set; } /// - /// The type of a streaming event. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonPropertyName("delta")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.Delta2JsonConverter))] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + public required global::Anthropic.Delta2 Delta { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -40,23 +40,19 @@ public sealed partial class ContentBlockDeltaEvent /// /// Initializes a new instance of the class. /// - /// - /// A delta in a streaming message. - /// - /// - /// The index of the content block. - /// /// - /// The type of a streaming event. + /// Default Value: content_block_delta /// + /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ContentBlockDeltaEvent( - global::Anthropic.BlockDelta delta, int index, - global::Anthropic.MessageStreamEventType type) + global::Anthropic.Delta2 delta, + global::Anthropic.ContentBlockDeltaEventType type = global::Anthropic.ContentBlockDeltaEventType.ContentBlockDelta) { - this.Delta = delta; this.Index = index; + this.Delta = delta; this.Type = type; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminator.Json.g.cs new file mode 100644 index 0000000..fa4dc69 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ContentBlockDeltaEventDeltaDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator), + jsonSerializerContext) as global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminator.g.cs new file mode 100644 index 0000000..5d52f42 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class ContentBlockDeltaEventDeltaDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorTypeJsonConverter))] + public global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ContentBlockDeltaEventDeltaDiscriminator( + global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public ContentBlockDeltaEventDeltaDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminatorType.g.cs new file mode 100644 index 0000000..2ad30f3 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventDeltaDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ContentBlockDeltaEventDeltaDiscriminatorType + { + /// + /// + /// + InputJsonDelta, + /// + /// + /// + TextDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ContentBlockDeltaEventDeltaDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ContentBlockDeltaEventDeltaDiscriminatorType value) + { + return value switch + { + ContentBlockDeltaEventDeltaDiscriminatorType.InputJsonDelta => "input_json_delta", + ContentBlockDeltaEventDeltaDiscriminatorType.TextDelta => "text_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ContentBlockDeltaEventDeltaDiscriminatorType? ToEnum(string value) + { + return value switch + { + "input_json_delta" => ContentBlockDeltaEventDeltaDiscriminatorType.InputJsonDelta, + "text_delta" => ContentBlockDeltaEventDeltaDiscriminatorType.TextDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventType.g.cs new file mode 100644 index 0000000..112788d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDeltaEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: content_block_delta + /// + public enum ContentBlockDeltaEventType + { + /// + /// + /// + ContentBlockDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ContentBlockDeltaEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ContentBlockDeltaEventType value) + { + return value switch + { + ContentBlockDeltaEventType.ContentBlockDelta => "content_block_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ContentBlockDeltaEventType? ToEnum(string value) + { + return value switch + { + "content_block_delta" => ContentBlockDeltaEventType.ContentBlockDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminator.Json.g.cs new file mode 100644 index 0000000..e733974 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ContentBlockDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentBlockDiscriminator), + jsonSerializerContext) as global::Anthropic.ContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentBlockDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminator.g.cs similarity index 58% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolDiscriminator.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminator.g.cs index 8fb3f93..4ad9667 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolDiscriminator.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminator.g.cs @@ -6,13 +6,14 @@ namespace Anthropic /// /// /// - public sealed partial class ToolDiscriminator + public sealed partial class ContentBlockDiscriminator { /// /// /// [global::System.Text.Json.Serialization.JsonPropertyName("type")] - public string? Type { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlockDiscriminatorTypeJsonConverter))] + public global::Anthropic.ContentBlockDiscriminatorType? Type { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -21,20 +22,20 @@ public sealed partial class ToolDiscriminator public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolDiscriminator( - string? type) + public ContentBlockDiscriminator( + global::Anthropic.ContentBlockDiscriminatorType? type) { this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ToolDiscriminator() + public ContentBlockDiscriminator() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..d944afd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ContentBlockDiscriminatorType + { + /// + /// + /// + Text, + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ContentBlockDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ContentBlockDiscriminatorType value) + { + return value switch + { + ContentBlockDiscriminatorType.Text => "text", + ContentBlockDiscriminatorType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ContentBlockDiscriminatorType? ToEnum(string value) + { + return value switch + { + "text" => ContentBlockDiscriminatorType.Text, + "tool_use" => ContentBlockDiscriminatorType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEvent.g.cs index 051bec8..27dea8d 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEvent.g.cs @@ -4,32 +4,32 @@ namespace Anthropic { /// - /// A start event in a streaming content block. + /// /// public sealed partial class ContentBlockStartEvent { /// - /// A block of content in a message. + /// Default Value: content_block_start /// - [global::System.Text.Json.Serialization.JsonPropertyName("content_block")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BlockJsonConverter))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.Block ContentBlock { get; set; } + /// global::Anthropic.ContentBlockStartEventType.ContentBlockStart + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlockStartEventTypeJsonConverter))] + public global::Anthropic.ContentBlockStartEventType Type { get; set; } = global::Anthropic.ContentBlockStartEventType.ContentBlockStart; /// - /// The index of the content block. + /// /// [global::System.Text.Json.Serialization.JsonPropertyName("index")] [global::System.Text.Json.Serialization.JsonRequired] public required int Index { get; set; } /// - /// The type of a streaming event. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonPropertyName("content_block")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlock2JsonConverter))] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + public required global::Anthropic.ContentBlock2 ContentBlock { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -40,23 +40,19 @@ public sealed partial class ContentBlockStartEvent /// /// Initializes a new instance of the class. /// - /// - /// A block of content in a message. - /// - /// - /// The index of the content block. - /// /// - /// The type of a streaming event. + /// Default Value: content_block_start /// + /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ContentBlockStartEvent( - global::Anthropic.Block contentBlock, int index, - global::Anthropic.MessageStreamEventType type) + global::Anthropic.ContentBlock2 contentBlock, + global::Anthropic.ContentBlockStartEventType type = global::Anthropic.ContentBlockStartEventType.ContentBlockStart) { - this.ContentBlock = contentBlock; this.Index = index; + this.ContentBlock = contentBlock; this.Type = type; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminator.Json.g.cs new file mode 100644 index 0000000..aa8c4bc --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ContentBlockStartEventContentBlockDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentBlockStartEventContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentBlockStartEventContentBlockDiscriminator), + jsonSerializerContext) as global::Anthropic.ContentBlockStartEventContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentBlockStartEventContentBlockDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentBlockStartEventContentBlockDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentBlockStartEventContentBlockDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminator.g.cs new file mode 100644 index 0000000..8b16b1a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class ContentBlockStartEventContentBlockDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlockStartEventContentBlockDiscriminatorTypeJsonConverter))] + public global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ContentBlockStartEventContentBlockDiscriminator( + global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public ContentBlockStartEventContentBlockDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..1b81e65 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventContentBlockDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ContentBlockStartEventContentBlockDiscriminatorType + { + /// + /// + /// + Text, + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ContentBlockStartEventContentBlockDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ContentBlockStartEventContentBlockDiscriminatorType value) + { + return value switch + { + ContentBlockStartEventContentBlockDiscriminatorType.Text => "text", + ContentBlockStartEventContentBlockDiscriminatorType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ContentBlockStartEventContentBlockDiscriminatorType? ToEnum(string value) + { + return value switch + { + "text" => ContentBlockStartEventContentBlockDiscriminatorType.Text, + "tool_use" => ContentBlockStartEventContentBlockDiscriminatorType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventType.g.cs new file mode 100644 index 0000000..d32dbce --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStartEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: content_block_start + /// + public enum ContentBlockStartEventType + { + /// + /// + /// + ContentBlockStart, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ContentBlockStartEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ContentBlockStartEventType value) + { + return value switch + { + ContentBlockStartEventType.ContentBlockStart => "content_block_start", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ContentBlockStartEventType? ToEnum(string value) + { + return value switch + { + "content_block_start" => ContentBlockStartEventType.ContentBlockStart, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStopEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStopEvent.g.cs index 3234001..da13345 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStopEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStopEvent.g.cs @@ -4,24 +4,24 @@ namespace Anthropic { /// - /// A stop event in a streaming content block. + /// /// public sealed partial class ContentBlockStopEvent { /// - /// The index of the content block. + /// Default Value: content_block_stop /// - [global::System.Text.Json.Serialization.JsonPropertyName("index")] - [global::System.Text.Json.Serialization.JsonRequired] - public required int Index { get; set; } + /// global::Anthropic.ContentBlockStopEventType.ContentBlockStop + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ContentBlockStopEventTypeJsonConverter))] + public global::Anthropic.ContentBlockStopEventType Type { get; set; } = global::Anthropic.ContentBlockStopEventType.ContentBlockStop; /// - /// The type of a streaming event. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonPropertyName("index")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + public required int Index { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -32,16 +32,14 @@ public sealed partial class ContentBlockStopEvent /// /// Initializes a new instance of the class. /// - /// - /// The index of the content block. - /// /// - /// The type of a streaming event. + /// Default Value: content_block_stop /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ContentBlockStopEvent( int index, - global::Anthropic.MessageStreamEventType type) + global::Anthropic.ContentBlockStopEventType type = global::Anthropic.ContentBlockStopEventType.ContentBlockStop) { this.Index = index; this.Type = type; diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStopEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStopEventType.g.cs new file mode 100644 index 0000000..e2df43d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentBlockStopEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: content_block_stop + /// + public enum ContentBlockStopEventType + { + /// + /// + /// + ContentBlockStop, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ContentBlockStopEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ContentBlockStopEventType value) + { + return value switch + { + ContentBlockStopEventType.ContentBlockStop => "content_block_stop", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ContentBlockStopEventType? ToEnum(string value) + { + return value switch + { + "content_block_stop" => ContentBlockStopEventType.ContentBlockStop, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item.Json.g.cs new file mode 100644 index 0000000..c12a816 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentVariant2Item + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentVariant2Item? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentVariant2Item), + jsonSerializerContext) as global::Anthropic.ContentVariant2Item?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentVariant2Item? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentVariant2Item), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentVariant2Item?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item.g.cs new file mode 100644 index 0000000..14ddc73 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ContentVariant2Item : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRequestTextBlock? Text { get; init; } +#else + public global::Anthropic.BetaRequestTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item(global::Anthropic.BetaRequestTextBlock value) => new ContentVariant2Item(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRequestTextBlock?(ContentVariant2Item @this) => @this.Text; + + /// + /// + /// + public ContentVariant2Item(global::Anthropic.BetaRequestTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRequestImageBlock? Image { get; init; } +#else + public global::Anthropic.BetaRequestImageBlock? Image { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Image))] +#endif + public bool IsImage => Image != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item(global::Anthropic.BetaRequestImageBlock value) => new ContentVariant2Item(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRequestImageBlock?(ContentVariant2Item @this) => @this.Image; + + /// + /// + /// + public ContentVariant2Item(global::Anthropic.BetaRequestImageBlock? value) + { + Image = value; + } + + /// + /// + /// + public ContentVariant2Item( + global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? type, + global::Anthropic.BetaRequestTextBlock? text, + global::Anthropic.BetaRequestImageBlock? image + ) + { + Type = type; + + Text = text; + Image = image; + } + + /// + /// + /// + public object? Object => + Image as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsImage || !IsText && IsImage; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? image = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsImage && image != null) + { + return image(Image!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? image = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsImage) + { + image?.Invoke(Image!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.BetaRequestTextBlock), + Image, + typeof(global::Anthropic.BetaRequestImageBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ContentVariant2Item other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Image, other.Image) + ; + } + + /// + /// + /// + public static bool operator ==(ContentVariant2Item obj1, ContentVariant2Item obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ContentVariant2Item obj1, ContentVariant2Item obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ContentVariant2Item o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item2.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item2.Json.g.cs new file mode 100644 index 0000000..8d88db9 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentVariant2Item2 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentVariant2Item2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentVariant2Item2), + jsonSerializerContext) as global::Anthropic.ContentVariant2Item2?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentVariant2Item2? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentVariant2Item2), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentVariant2Item2?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Block.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item2.g.cs similarity index 58% rename from src/libs/Anthropic/Generated/Anthropic.Models.Block.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item2.g.cs index ec32474..8cce693 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Block.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item2.g.cs @@ -5,22 +5,22 @@ namespace Anthropic { /// - /// A block of content in a message. + /// /// - public readonly partial struct Block : global::System.IEquatable + public readonly partial struct ContentVariant2Item2 : global::System.IEquatable { /// /// /// - public global::Anthropic.BlockDiscriminatorType? Type { get; } + public global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType? Type { get; } /// - /// A block of text content. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.TextBlock? Text { get; init; } + public global::Anthropic.RequestTextBlock? Text { get; init; } #else - public global::Anthropic.TextBlock? Text { get; } + public global::Anthropic.RequestTextBlock? Text { get; } #endif /// @@ -34,28 +34,28 @@ namespace Anthropic /// /// /// - public static implicit operator Block(global::Anthropic.TextBlock value) => new Block(value); + public static implicit operator ContentVariant2Item2(global::Anthropic.RequestTextBlock value) => new ContentVariant2Item2(value); /// /// /// - public static implicit operator global::Anthropic.TextBlock?(Block @this) => @this.Text; + public static implicit operator global::Anthropic.RequestTextBlock?(ContentVariant2Item2 @this) => @this.Text; /// /// /// - public Block(global::Anthropic.TextBlock? value) + public ContentVariant2Item2(global::Anthropic.RequestTextBlock? value) { Text = value; } /// - /// A block of image content. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.ImageBlock? Image { get; init; } + public global::Anthropic.RequestImageBlock? Image { get; init; } #else - public global::Anthropic.ImageBlock? Image { get; } + public global::Anthropic.RequestImageBlock? Image { get; } #endif /// @@ -69,28 +69,28 @@ public Block(global::Anthropic.TextBlock? value) /// /// /// - public static implicit operator Block(global::Anthropic.ImageBlock value) => new Block(value); + public static implicit operator ContentVariant2Item2(global::Anthropic.RequestImageBlock value) => new ContentVariant2Item2(value); /// /// /// - public static implicit operator global::Anthropic.ImageBlock?(Block @this) => @this.Image; + public static implicit operator global::Anthropic.RequestImageBlock?(ContentVariant2Item2 @this) => @this.Image; /// /// /// - public Block(global::Anthropic.ImageBlock? value) + public ContentVariant2Item2(global::Anthropic.RequestImageBlock? value) { Image = value; } /// - /// The tool the model wants to use. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.ToolUseBlock? ToolUse { get; init; } + public global::Anthropic.RequestToolUseBlock? ToolUse { get; init; } #else - public global::Anthropic.ToolUseBlock? ToolUse { get; } + public global::Anthropic.RequestToolUseBlock? ToolUse { get; } #endif /// @@ -104,28 +104,28 @@ public Block(global::Anthropic.ImageBlock? value) /// /// /// - public static implicit operator Block(global::Anthropic.ToolUseBlock value) => new Block(value); + public static implicit operator ContentVariant2Item2(global::Anthropic.RequestToolUseBlock value) => new ContentVariant2Item2(value); /// /// /// - public static implicit operator global::Anthropic.ToolUseBlock?(Block @this) => @this.ToolUse; + public static implicit operator global::Anthropic.RequestToolUseBlock?(ContentVariant2Item2 @this) => @this.ToolUse; /// /// /// - public Block(global::Anthropic.ToolUseBlock? value) + public ContentVariant2Item2(global::Anthropic.RequestToolUseBlock? value) { ToolUse = value; } /// - /// The result of using a tool. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.ToolResultBlock? ToolResult { get; init; } + public global::Anthropic.RequestToolResultBlock? ToolResult { get; init; } #else - public global::Anthropic.ToolResultBlock? ToolResult { get; } + public global::Anthropic.RequestToolResultBlock? ToolResult { get; } #endif /// @@ -139,17 +139,17 @@ public Block(global::Anthropic.ToolUseBlock? value) /// /// /// - public static implicit operator Block(global::Anthropic.ToolResultBlock value) => new Block(value); + public static implicit operator ContentVariant2Item2(global::Anthropic.RequestToolResultBlock value) => new ContentVariant2Item2(value); /// /// /// - public static implicit operator global::Anthropic.ToolResultBlock?(Block @this) => @this.ToolResult; + public static implicit operator global::Anthropic.RequestToolResultBlock?(ContentVariant2Item2 @this) => @this.ToolResult; /// /// /// - public Block(global::Anthropic.ToolResultBlock? value) + public ContentVariant2Item2(global::Anthropic.RequestToolResultBlock? value) { ToolResult = value; } @@ -157,12 +157,12 @@ public Block(global::Anthropic.ToolResultBlock? value) /// /// /// - public Block( - global::Anthropic.BlockDiscriminatorType? type, - global::Anthropic.TextBlock? text, - global::Anthropic.ImageBlock? image, - global::Anthropic.ToolUseBlock? toolUse, - global::Anthropic.ToolResultBlock? toolResult + public ContentVariant2Item2( + global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType? type, + global::Anthropic.RequestTextBlock? text, + global::Anthropic.RequestImageBlock? image, + global::Anthropic.RequestToolUseBlock? toolUse, + global::Anthropic.RequestToolResultBlock? toolResult ) { Type = type; @@ -195,10 +195,10 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? text = null, - global::System.Func? image = null, - global::System.Func? toolUse = null, - global::System.Func? toolResult = null, + global::System.Func? text = null, + global::System.Func? image = null, + global::System.Func? toolUse = null, + global::System.Func? toolResult = null, bool validate = true) { if (validate) @@ -230,10 +230,10 @@ public bool Validate() /// /// public void Match( - global::System.Action? text = null, - global::System.Action? image = null, - global::System.Action? toolUse = null, - global::System.Action? toolResult = null, + global::System.Action? text = null, + global::System.Action? image = null, + global::System.Action? toolUse = null, + global::System.Action? toolResult = null, bool validate = true) { if (validate) @@ -267,13 +267,13 @@ public override int GetHashCode() var fields = new object?[] { Text, - typeof(global::Anthropic.TextBlock), + typeof(global::Anthropic.RequestTextBlock), Image, - typeof(global::Anthropic.ImageBlock), + typeof(global::Anthropic.RequestImageBlock), ToolUse, - typeof(global::Anthropic.ToolUseBlock), + typeof(global::Anthropic.RequestToolUseBlock), ToolResult, - typeof(global::Anthropic.ToolResultBlock), + typeof(global::Anthropic.RequestToolResultBlock), }; const int offset = unchecked((int)2166136261); const int prime = 16777619; @@ -287,28 +287,28 @@ static int HashCodeAggregator(int hashCode, object? value) => value == null /// /// /// - public bool Equals(Block other) + public bool Equals(ContentVariant2Item2 other) { return - global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(Image, other.Image) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolResult, other.ToolResult) + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Image, other.Image) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolResult, other.ToolResult) ; } /// /// /// - public static bool operator ==(Block obj1, Block obj2) + public static bool operator ==(ContentVariant2Item2 obj1, ContentVariant2Item2 obj2) { - return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); } /// /// /// - public static bool operator !=(Block obj1, Block obj2) + public static bool operator !=(ContentVariant2Item2 obj1, ContentVariant2Item2 obj2) { return !(obj1 == obj2); } @@ -318,7 +318,7 @@ public bool Equals(Block other) /// public override bool Equals(object? obj) { - return obj is Block o && Equals(o); + return obj is ContentVariant2Item2 o && Equals(o); } } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item3.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item3.Json.g.cs new file mode 100644 index 0000000..ff095db --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item3.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentVariant2Item3 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentVariant2Item3? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentVariant2Item3), + jsonSerializerContext) as global::Anthropic.ContentVariant2Item3?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentVariant2Item3? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentVariant2Item3), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentVariant2Item3?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item3.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item3.g.cs new file mode 100644 index 0000000..334c447 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item3.g.cs @@ -0,0 +1,324 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ContentVariant2Item3 : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PromptCachingBetaRequestTextBlock? Text { get; init; } +#else + public global::Anthropic.PromptCachingBetaRequestTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestTextBlock value) => new ContentVariant2Item3(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PromptCachingBetaRequestTextBlock?(ContentVariant2Item3 @this) => @this.Text; + + /// + /// + /// + public ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PromptCachingBetaRequestImageBlock? Image { get; init; } +#else + public global::Anthropic.PromptCachingBetaRequestImageBlock? Image { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Image))] +#endif + public bool IsImage => Image != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestImageBlock value) => new ContentVariant2Item3(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PromptCachingBetaRequestImageBlock?(ContentVariant2Item3 @this) => @this.Image; + + /// + /// + /// + public ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestImageBlock? value) + { + Image = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PromptCachingBetaRequestToolUseBlock? ToolUse { get; init; } +#else + public global::Anthropic.PromptCachingBetaRequestToolUseBlock? ToolUse { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolUse))] +#endif + public bool IsToolUse => ToolUse != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestToolUseBlock value) => new ContentVariant2Item3(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PromptCachingBetaRequestToolUseBlock?(ContentVariant2Item3 @this) => @this.ToolUse; + + /// + /// + /// + public ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestToolUseBlock? value) + { + ToolUse = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PromptCachingBetaRequestToolResultBlock? ToolResult { get; init; } +#else + public global::Anthropic.PromptCachingBetaRequestToolResultBlock? ToolResult { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ToolResult))] +#endif + public bool IsToolResult => ToolResult != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestToolResultBlock value) => new ContentVariant2Item3(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PromptCachingBetaRequestToolResultBlock?(ContentVariant2Item3 @this) => @this.ToolResult; + + /// + /// + /// + public ContentVariant2Item3(global::Anthropic.PromptCachingBetaRequestToolResultBlock? value) + { + ToolResult = value; + } + + /// + /// + /// + public ContentVariant2Item3( + global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? type, + global::Anthropic.PromptCachingBetaRequestTextBlock? text, + global::Anthropic.PromptCachingBetaRequestImageBlock? image, + global::Anthropic.PromptCachingBetaRequestToolUseBlock? toolUse, + global::Anthropic.PromptCachingBetaRequestToolResultBlock? toolResult + ) + { + Type = type; + + Text = text; + Image = image; + ToolUse = toolUse; + ToolResult = toolResult; + } + + /// + /// + /// + public object? Object => + ToolResult as object ?? + ToolUse as object ?? + Image as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsImage && !IsToolUse && !IsToolResult || !IsText && IsImage && !IsToolUse && !IsToolResult || !IsText && !IsImage && IsToolUse && !IsToolResult || !IsText && !IsImage && !IsToolUse && IsToolResult; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? image = null, + global::System.Func? toolUse = null, + global::System.Func? toolResult = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsImage && image != null) + { + return image(Image!); + } + else if (IsToolUse && toolUse != null) + { + return toolUse(ToolUse!); + } + else if (IsToolResult && toolResult != null) + { + return toolResult(ToolResult!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? image = null, + global::System.Action? toolUse = null, + global::System.Action? toolResult = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsImage) + { + image?.Invoke(Image!); + } + else if (IsToolUse) + { + toolUse?.Invoke(ToolUse!); + } + else if (IsToolResult) + { + toolResult?.Invoke(ToolResult!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), + Image, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), + ToolUse, + typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlock), + ToolResult, + typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ContentVariant2Item3 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Image, other.Image) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolUse, other.ToolUse) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ToolResult, other.ToolResult) + ; + } + + /// + /// + /// + public static bool operator ==(ContentVariant2Item3 obj1, ContentVariant2Item3 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ContentVariant2Item3 obj1, ContentVariant2Item3 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ContentVariant2Item3 o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item4.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item4.Json.g.cs new file mode 100644 index 0000000..070a367 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item4.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentVariant2Item4 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentVariant2Item4? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentVariant2Item4), + jsonSerializerContext) as global::Anthropic.ContentVariant2Item4?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentVariant2Item4? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentVariant2Item4), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentVariant2Item4?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item4.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item4.g.cs new file mode 100644 index 0000000..a8515c6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item4.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ContentVariant2Item4 : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PromptCachingBetaRequestTextBlock? Text { get; init; } +#else + public global::Anthropic.PromptCachingBetaRequestTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item4(global::Anthropic.PromptCachingBetaRequestTextBlock value) => new ContentVariant2Item4(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PromptCachingBetaRequestTextBlock?(ContentVariant2Item4 @this) => @this.Text; + + /// + /// + /// + public ContentVariant2Item4(global::Anthropic.PromptCachingBetaRequestTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PromptCachingBetaRequestImageBlock? Image { get; init; } +#else + public global::Anthropic.PromptCachingBetaRequestImageBlock? Image { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Image))] +#endif + public bool IsImage => Image != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item4(global::Anthropic.PromptCachingBetaRequestImageBlock value) => new ContentVariant2Item4(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PromptCachingBetaRequestImageBlock?(ContentVariant2Item4 @this) => @this.Image; + + /// + /// + /// + public ContentVariant2Item4(global::Anthropic.PromptCachingBetaRequestImageBlock? value) + { + Image = value; + } + + /// + /// + /// + public ContentVariant2Item4( + global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? type, + global::Anthropic.PromptCachingBetaRequestTextBlock? text, + global::Anthropic.PromptCachingBetaRequestImageBlock? image + ) + { + Type = type; + + Text = text; + Image = image; + } + + /// + /// + /// + public object? Object => + Image as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsImage || !IsText && IsImage; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? image = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsImage && image != null) + { + return image(Image!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? image = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsImage) + { + image?.Invoke(Image!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), + Image, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ContentVariant2Item4 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Image, other.Image) + ; + } + + /// + /// + /// + public static bool operator ==(ContentVariant2Item4 obj1, ContentVariant2Item4 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ContentVariant2Item4 obj1, ContentVariant2Item4 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ContentVariant2Item4 o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item5.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item5.Json.g.cs new file mode 100644 index 0000000..0320182 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item5.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct ContentVariant2Item5 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ContentVariant2Item5? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ContentVariant2Item5), + jsonSerializerContext) as global::Anthropic.ContentVariant2Item5?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ContentVariant2Item5? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ContentVariant2Item5), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ContentVariant2Item5?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item5.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item5.g.cs new file mode 100644 index 0000000..22be3a0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ContentVariant2Item5.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ContentVariant2Item5 : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.RequestTextBlock? Text { get; init; } +#else + public global::Anthropic.RequestTextBlock? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item5(global::Anthropic.RequestTextBlock value) => new ContentVariant2Item5(value); + + /// + /// + /// + public static implicit operator global::Anthropic.RequestTextBlock?(ContentVariant2Item5 @this) => @this.Text; + + /// + /// + /// + public ContentVariant2Item5(global::Anthropic.RequestTextBlock? value) + { + Text = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.RequestImageBlock? Image { get; init; } +#else + public global::Anthropic.RequestImageBlock? Image { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Image))] +#endif + public bool IsImage => Image != null; + + /// + /// + /// + public static implicit operator ContentVariant2Item5(global::Anthropic.RequestImageBlock value) => new ContentVariant2Item5(value); + + /// + /// + /// + public static implicit operator global::Anthropic.RequestImageBlock?(ContentVariant2Item5 @this) => @this.Image; + + /// + /// + /// + public ContentVariant2Item5(global::Anthropic.RequestImageBlock? value) + { + Image = value; + } + + /// + /// + /// + public ContentVariant2Item5( + global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType? type, + global::Anthropic.RequestTextBlock? text, + global::Anthropic.RequestImageBlock? image + ) + { + Type = type; + + Text = text; + Image = image; + } + + /// + /// + /// + public object? Object => + Image as object ?? + Text as object + ; + + /// + /// + /// + public bool Validate() + { + return IsText && !IsImage || !IsText && IsImage; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? text = null, + global::System.Func? image = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText && text != null) + { + return text(Text!); + } + else if (IsImage && image != null) + { + return image(Image!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? text = null, + global::System.Action? image = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsImage) + { + image?.Invoke(Image!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Text, + typeof(global::Anthropic.RequestTextBlock), + Image, + typeof(global::Anthropic.RequestImageBlock), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ContentVariant2Item5 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Image, other.Image) + ; + } + + /// + /// + /// + public static bool operator ==(ContentVariant2Item5 obj1, ContentVariant2Item5 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ContentVariant2Item5 obj1, ContentVariant2Item5 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ContentVariant2Item5 o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequest.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParams.Json.g.cs similarity index 88% rename from src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequest.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParams.Json.g.cs index 1199d19..47d66b2 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequest.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParams.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class CreateMessageRequest + public sealed partial class CreateMessageParams { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.CreateMessageRequest? FromJson( + public static global::Anthropic.CreateMessageParams? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.CreateMessageRequest), - jsonSerializerContext) as global::Anthropic.CreateMessageRequest; + typeof(global::Anthropic.CreateMessageParams), + jsonSerializerContext) as global::Anthropic.CreateMessageParams; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.CreateMessageRequest? FromJson( + public static global::Anthropic.CreateMessageParams? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.CreateMessageRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.CreateMessageRequest; + typeof(global::Anthropic.CreateMessageParams), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.CreateMessageParams; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequest.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParams.g.cs similarity index 50% rename from src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequest.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParams.g.cs index 5d09759..8ba1f3e 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequest.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParams.g.cs @@ -6,105 +6,78 @@ namespace Anthropic { /// - /// The request parameters for creating a message. + /// /// - public sealed partial class CreateMessageRequest + public sealed partial class CreateMessageParams { /// - /// The model that will complete your prompt.
- /// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
- /// details and options.
- /// Example: claude-3-5-sonnet-20241022 + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. ///
- /// claude-3-5-sonnet-20241022 [global::System.Text.Json.Serialization.JsonPropertyName("model")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.AnyOf Model { get; set; } + public required global::Anthropic.Model Model { get; set; } /// /// Input messages.
- /// Our models are trained to operate on alternating `user` and `assistant`
- /// conversational turns. When creating a new `Message`, you specify the prior
- /// conversational turns with the `messages` parameter, and the model then generates
- /// the next `Message` in the conversation.
- /// Each input message must be an object with a `role` and `content`. You can
- /// specify a single `user`-role message, or you can include multiple `user` and
- /// `assistant` messages. The first message must always use the `user` role.
- /// If the final message uses the `assistant` role, the response content will
- /// continue immediately from the content in that message. This can be used to
- /// constrain part of the model's response.
- /// See [message content](https://docs.anthropic.com/en/api/messages-content) for
- /// details on how to construct valid message objects.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
/// Example with a single `user` message:
/// ```json
- /// [{ "role": "user", "content": "Hello, Claude" }]
+ /// [{"role": "user", "content": "Hello, Claude"}]
/// ```
/// Example with multiple conversational turns:
/// ```json
/// [
- /// { "role": "user", "content": "Hello there." },
- /// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
- /// { "role": "user", "content": "Can you explain LLMs in plain English?" }
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
/// ]
/// ```
/// Example with a partially-filled response from Claude:
/// ```json
/// [
- /// {
- /// "role": "user",
- /// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
- /// },
- /// { "role": "assistant", "content": "The best answer is (" }
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
/// ]
/// ```
- /// Each input message `content` may be either a single `string` or an array of
- /// content blocks, where each block has a specific `type`. Using a `string` for
- /// `content` is shorthand for an array of one content block of type `"text"`. The
- /// following input messages are equivalent:
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
/// ```json
- /// { "role": "user", "content": "Hello, Claude" }
+ /// {"role": "user", "content": "Hello, Claude"}
/// ```
/// ```json
- /// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
/// ```
/// Starting with Claude 3 models, you can also send image content blocks:
/// ```json
- /// {
- /// "role": "user",
- /// "content": [
- /// {
- /// "type": "image",
- /// "source": {
- /// "type": "base64",
- /// "media_type": "image/jpeg",
- /// "data": "/9j/4AAQSkZJRg..."
- /// }
- /// },
- /// { "type": "text", "text": "What is in this image?" }
- /// ]
- /// }
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
/// ```
- /// We currently support the `base64` source type for images, and the `image/jpeg`,
- /// `image/png`, `image/gif`, and `image/webp` media types.
- /// See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
- /// input examples.
- /// Note that if you want to include a
- /// [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
- /// the top-level `system` parameter — there is no `"system"` role for input
- /// messages in the Messages API. + /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. ///
[global::System.Text.Json.Serialization.JsonPropertyName("messages")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::System.Collections.Generic.IList Messages { get; set; } + public required global::System.Collections.Generic.IList Messages { get; set; } /// /// The maximum number of tokens to generate before stopping.
- /// Note that our models may stop _before_ reaching this maximum. This parameter
- /// only specifies the absolute maximum number of tokens to generate.
- /// Different models have different maximum values for this parameter. See
- /// [models](https://docs.anthropic.com/en/docs/models-overview) for details. + /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 ///
+ /// 1024 [global::System.Text.Json.Serialization.JsonPropertyName("max_tokens")] [global::System.Text.Json.Serialization.JsonRequired] public required int MaxTokens { get; set; } @@ -113,62 +86,57 @@ public sealed partial class CreateMessageRequest /// An object describing metadata about the request. ///
[global::System.Text.Json.Serialization.JsonPropertyName("metadata")] - public global::Anthropic.CreateMessageRequestMetadata? Metadata { get; set; } + public global::Anthropic.Metadata? Metadata { get; set; } /// /// Custom text sequences that will cause the model to stop generating.
- /// Our models will normally stop when they have naturally completed their turn,
- /// which will result in a response `stop_reason` of `"end_turn"`.
- /// If you want the model to stop generating when it encounters custom strings of
- /// text, you can use the `stop_sequences` parameter. If the model encounters one of
- /// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
- /// and the response `stop_sequence` value will contain the matched stop sequence. + /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. ///
[global::System.Text.Json.Serialization.JsonPropertyName("stop_sequences")] public global::System.Collections.Generic.IList? StopSequences { get; set; } + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stream")] + public bool? Stream { get; set; } + /// /// System prompt.
- /// A system prompt is a way of providing context and instructions to Claude, such
- /// as specifying a particular goal or role. See our
- /// [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). + /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] ///
+ /// [] [global::System.Text.Json.Serialization.JsonPropertyName("system")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.OneOfJsonConverter>))] - public global::Anthropic.OneOf>? System { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? System { get; set; } /// /// Amount of randomness injected into the response.
- /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
- /// for analytical / multiple choice, and closer to `1.0` for creative and
- /// generative tasks.
- /// Note that even with `temperature` of `0.0`, the results will not be fully
- /// deterministic. + /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 ///
+ /// 1 [global::System.Text.Json.Serialization.JsonPropertyName("temperature")] public double? Temperature { get; set; } /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. ///
[global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceJsonConverter))] public global::Anthropic.ToolChoice? ToolChoice { get; set; } /// /// Definitions of tools that the model may use.
- /// If you include `tools` in your API request, the model may return `tool_use`
- /// content blocks that represent the model's use of those tools. You can then run
- /// those tools using the tool input generated by the model and then optionally
- /// return results back to the model using `tool_result` content blocks.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
/// Each tool definition includes:
- /// - `name`: Name of the tool.
- /// - `description`: Optional, but strongly-recommended description of the tool.
- /// - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
- /// shape that the model will produce in `tool_use` output content blocks.
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
/// For example, if you defined `tools` as:
/// ```json
/// [
@@ -188,8 +156,7 @@ public sealed partial class CreateMessageRequest /// }
/// ]
/// ```
- /// And then asked the model "What's the S&P 500 at today?", the model might produce
- /// `tool_use` content blocks in the response like this:
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
/// ```json
/// [
/// {
@@ -200,9 +167,7 @@ public sealed partial class CreateMessageRequest /// }
/// ]
/// ```
- /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
- /// input, and return the following back to the model in a subsequent `user`
- /// message:
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
/// ```json
/// [
/// {
@@ -212,9 +177,7 @@ public sealed partial class CreateMessageRequest /// }
/// ]
/// ```
- /// Tools can be used for workflows that include running client-side tools and
- /// functions, or more generally whenever you want the model to produce a particular
- /// JSON structure of output.
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
/// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. ///
[global::System.Text.Json.Serialization.JsonPropertyName("tools")] @@ -222,35 +185,24 @@ public sealed partial class CreateMessageRequest /// /// Only sample from the top K options for each subsequent token.
- /// Used to remove "long tail" low probability responses.
- /// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. + /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 ///
+ /// 5 [global::System.Text.Json.Serialization.JsonPropertyName("top_k")] public int? TopK { get; set; } /// /// Use nucleus sampling.
- /// In nucleus sampling, we compute the cumulative distribution over all the options
- /// for each subsequent token in decreasing probability order and cut it off once it
- /// reaches a particular probability specified by `top_p`. You should either alter
- /// `temperature` or `top_p`, but not both.
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. + /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 ///
+ /// 0.7 [global::System.Text.Json.Serialization.JsonPropertyName("top_p")] public double? TopP { get; set; } - /// - /// Whether to incrementally stream the response using server-sent events.
- /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
- /// details.
- /// Default Value: false - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("stream")] - public bool? Stream { get; set; } - /// /// Additional properties that are not explicitly defined in the schema /// @@ -258,137 +210,99 @@ public sealed partial class CreateMessageRequest public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// The model that will complete your prompt.
- /// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
- /// details and options.
- /// Example: claude-3-5-sonnet-20241022 + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. /// /// /// Input messages.
- /// Our models are trained to operate on alternating `user` and `assistant`
- /// conversational turns. When creating a new `Message`, you specify the prior
- /// conversational turns with the `messages` parameter, and the model then generates
- /// the next `Message` in the conversation.
- /// Each input message must be an object with a `role` and `content`. You can
- /// specify a single `user`-role message, or you can include multiple `user` and
- /// `assistant` messages. The first message must always use the `user` role.
- /// If the final message uses the `assistant` role, the response content will
- /// continue immediately from the content in that message. This can be used to
- /// constrain part of the model's response.
- /// See [message content](https://docs.anthropic.com/en/api/messages-content) for
- /// details on how to construct valid message objects.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
/// Example with a single `user` message:
/// ```json
- /// [{ "role": "user", "content": "Hello, Claude" }]
+ /// [{"role": "user", "content": "Hello, Claude"}]
/// ```
/// Example with multiple conversational turns:
/// ```json
/// [
- /// { "role": "user", "content": "Hello there." },
- /// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
- /// { "role": "user", "content": "Can you explain LLMs in plain English?" }
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
/// ]
/// ```
/// Example with a partially-filled response from Claude:
/// ```json
/// [
- /// {
- /// "role": "user",
- /// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
- /// },
- /// { "role": "assistant", "content": "The best answer is (" }
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
/// ]
/// ```
- /// Each input message `content` may be either a single `string` or an array of
- /// content blocks, where each block has a specific `type`. Using a `string` for
- /// `content` is shorthand for an array of one content block of type `"text"`. The
- /// following input messages are equivalent:
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
/// ```json
- /// { "role": "user", "content": "Hello, Claude" }
+ /// {"role": "user", "content": "Hello, Claude"}
/// ```
/// ```json
- /// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
/// ```
/// Starting with Claude 3 models, you can also send image content blocks:
/// ```json
- /// {
- /// "role": "user",
- /// "content": [
- /// {
- /// "type": "image",
- /// "source": {
- /// "type": "base64",
- /// "media_type": "image/jpeg",
- /// "data": "/9j/4AAQSkZJRg..."
- /// }
- /// },
- /// { "type": "text", "text": "What is in this image?" }
- /// ]
- /// }
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
/// ```
- /// We currently support the `base64` source type for images, and the `image/jpeg`,
- /// `image/png`, `image/gif`, and `image/webp` media types.
- /// See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
- /// input examples.
- /// Note that if you want to include a
- /// [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
- /// the top-level `system` parameter — there is no `"system"` role for input
- /// messages in the Messages API. + /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. /// /// /// The maximum number of tokens to generate before stopping.
- /// Note that our models may stop _before_ reaching this maximum. This parameter
- /// only specifies the absolute maximum number of tokens to generate.
- /// Different models have different maximum values for this parameter. See
- /// [models](https://docs.anthropic.com/en/docs/models-overview) for details. + /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 /// /// /// An object describing metadata about the request. /// /// /// Custom text sequences that will cause the model to stop generating.
- /// Our models will normally stop when they have naturally completed their turn,
- /// which will result in a response `stop_reason` of `"end_turn"`.
- /// If you want the model to stop generating when it encounters custom strings of
- /// text, you can use the `stop_sequences` parameter. If the model encounters one of
- /// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
- /// and the response `stop_sequence` value will contain the matched stop sequence. + /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. /// /// /// System prompt.
- /// A system prompt is a way of providing context and instructions to Claude, such
- /// as specifying a particular goal or role. See our
- /// [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). + /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] /// /// /// Amount of randomness injected into the response.
- /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
- /// for analytical / multiple choice, and closer to `1.0` for creative and
- /// generative tasks.
- /// Note that even with `temperature` of `0.0`, the results will not be fully
- /// deterministic. + /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 /// /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. /// /// /// Definitions of tools that the model may use.
- /// If you include `tools` in your API request, the model may return `tool_use`
- /// content blocks that represent the model's use of those tools. You can then run
- /// those tools using the tool input generated by the model and then optionally
- /// return results back to the model using `tool_result` content blocks.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
/// Each tool definition includes:
- /// - `name`: Name of the tool.
- /// - `description`: Optional, but strongly-recommended description of the tool.
- /// - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
- /// shape that the model will produce in `tool_use` output content blocks.
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
/// For example, if you defined `tools` as:
/// ```json
/// [
@@ -408,8 +322,7 @@ public sealed partial class CreateMessageRequest /// }
/// ]
/// ```
- /// And then asked the model "What's the S&P 500 at today?", the model might produce
- /// `tool_use` content blocks in the response like this:
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
/// ```json
/// [
/// {
@@ -420,9 +333,7 @@ public sealed partial class CreateMessageRequest /// }
/// ]
/// ```
- /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
- /// input, and return the following back to the model in a subsequent `user`
- /// message:
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
/// ```json
/// [
/// {
@@ -432,66 +343,54 @@ public sealed partial class CreateMessageRequest /// }
/// ]
/// ```
- /// Tools can be used for workflows that include running client-side tools and
- /// functions, or more generally whenever you want the model to produce a particular
- /// JSON structure of output.
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
/// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. /// /// /// Only sample from the top K options for each subsequent token.
- /// Used to remove "long tail" low probability responses.
- /// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. + /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 /// /// /// Use nucleus sampling.
- /// In nucleus sampling, we compute the cumulative distribution over all the options
- /// for each subsequent token in decreasing probability order and cut it off once it
- /// reaches a particular probability specified by `top_p`. You should either alter
- /// `temperature` or `top_p`, but not both.
- /// Recommended for advanced use cases only. You usually only need to use
- /// `temperature`. - /// - /// - /// Whether to incrementally stream the response using server-sent events.
- /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
- /// details.
- /// Default Value: false + /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public CreateMessageRequest( - global::Anthropic.AnyOf model, - global::System.Collections.Generic.IList messages, + public CreateMessageParams( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, int maxTokens, - global::Anthropic.CreateMessageRequestMetadata? metadata, + global::Anthropic.Metadata? metadata, global::System.Collections.Generic.IList? stopSequences, - global::Anthropic.OneOf>? system, + bool? stream, + global::Anthropic.AnyOf>? system, double? temperature, global::Anthropic.ToolChoice? toolChoice, global::System.Collections.Generic.IList? tools, int? topK, - double? topP, - bool? stream) + double? topP) { this.Model = model; this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages)); this.MaxTokens = maxTokens; this.Metadata = metadata; this.StopSequences = stopSequences; + this.Stream = stream; this.System = system; this.Temperature = temperature; this.ToolChoice = toolChoice; this.Tools = tools; this.TopK = topK; this.TopP = topP; - this.Stream = stream; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public CreateMessageRequest() + public CreateMessageParams() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestMetadata.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParamsWithoutStream.Json.g.cs similarity index 85% rename from src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestMetadata.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParamsWithoutStream.Json.g.cs index 14091c6..18f7b0b 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestMetadata.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParamsWithoutStream.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class CreateMessageRequestMetadata + public sealed partial class CreateMessageParamsWithoutStream { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.CreateMessageRequestMetadata? FromJson( + public static global::Anthropic.CreateMessageParamsWithoutStream? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.CreateMessageRequestMetadata), - jsonSerializerContext) as global::Anthropic.CreateMessageRequestMetadata; + typeof(global::Anthropic.CreateMessageParamsWithoutStream), + jsonSerializerContext) as global::Anthropic.CreateMessageParamsWithoutStream; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.CreateMessageRequestMetadata? FromJson( + public static global::Anthropic.CreateMessageParamsWithoutStream? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.CreateMessageRequestMetadata), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.CreateMessageRequestMetadata; + typeof(global::Anthropic.CreateMessageParamsWithoutStream), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.CreateMessageParamsWithoutStream; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParamsWithoutStream.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParamsWithoutStream.g.cs new file mode 100644 index 0000000..0a58647 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageParamsWithoutStream.g.cs @@ -0,0 +1,384 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class CreateMessageParamsWithoutStream + { + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("messages")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Messages { get; set; } + + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + ///
+ /// 1024 + [global::System.Text.Json.Serialization.JsonPropertyName("max_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int MaxTokens { get; set; } + + /// + /// An object describing metadata about the request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("metadata")] + public global::Anthropic.Metadata? Metadata { get; set; } + + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_sequences")] + public global::System.Collections.Generic.IList? StopSequences { get; set; } + + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + ///
+ /// [] + [global::System.Text.Json.Serialization.JsonPropertyName("system")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? System { get; set; } + + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + ///
+ /// 1 + [global::System.Text.Json.Serialization.JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceJsonConverter))] + public global::Anthropic.ToolChoice? ToolChoice { get; set; } + + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("tools")] + public global::System.Collections.Generic.IList? Tools { get; set; } + + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + ///
+ /// 5 + [global::System.Text.Json.Serialization.JsonPropertyName("top_k")] + public int? TopK { get; set; } + + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + ///
+ /// 0.7 + [global::System.Text.Json.Serialization.JsonPropertyName("top_p")] + public double? TopP { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateMessageParamsWithoutStream( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + global::Anthropic.Metadata? metadata, + global::System.Collections.Generic.IList? stopSequences, + global::Anthropic.AnyOf>? system, + double? temperature, + global::Anthropic.ToolChoice? toolChoice, + global::System.Collections.Generic.IList? tools, + int? topK, + double? topP) + { + this.Model = model; + this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages)); + this.MaxTokens = maxTokens; + this.Metadata = metadata; + this.StopSequences = stopSequences; + this.System = system; + this.Temperature = temperature; + this.ToolChoice = toolChoice; + this.Tools = tools; + this.TopK = topK; + this.TopP = topP; + } + + /// + /// Initializes a new instance of the class. + /// + public CreateMessageParamsWithoutStream() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestModel.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestModel.g.cs deleted file mode 100644 index 3257672..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.CreateMessageRequestModel.g.cs +++ /dev/null @@ -1,93 +0,0 @@ - -#nullable enable - -namespace Anthropic -{ - /// - /// Available models. Mind that the list may not be exhaustive nor up-to-date. - /// - public enum CreateMessageRequestModel - { - /// - /// - /// - Claude35SonnetLatest, - /// - /// - /// - Claude35Sonnet20241022, - /// - /// - /// - Claude35Sonnet20240620, - /// - /// - /// - Claude3OpusLatest, - /// - /// - /// - Claude3Opus20240229, - /// - /// - /// - Claude3Sonnet20240229, - /// - /// - /// - Claude3Haiku20240307, - /// - /// - /// - Claude21, - /// - /// - /// - Claude20, - } - - /// - /// Enum extensions to do fast conversions without the reflection. - /// - public static class CreateMessageRequestModelExtensions - { - /// - /// Converts an enum to a string. - /// - public static string ToValueString(this CreateMessageRequestModel value) - { - return value switch - { - CreateMessageRequestModel.Claude35SonnetLatest => "claude-3-5-sonnet-latest", - CreateMessageRequestModel.Claude35Sonnet20241022 => "claude-3-5-sonnet-20241022", - CreateMessageRequestModel.Claude35Sonnet20240620 => "claude-3-5-sonnet-20240620", - CreateMessageRequestModel.Claude3OpusLatest => "claude-3-opus-latest", - CreateMessageRequestModel.Claude3Opus20240229 => "claude-3-opus-20240229", - CreateMessageRequestModel.Claude3Sonnet20240229 => "claude-3-sonnet-20240229", - CreateMessageRequestModel.Claude3Haiku20240307 => "claude-3-haiku-20240307", - CreateMessageRequestModel.Claude21 => "claude-2.1", - CreateMessageRequestModel.Claude20 => "claude-2.0", - _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), - }; - } - /// - /// Converts an string to a enum. - /// - public static CreateMessageRequestModel? ToEnum(string value) - { - return value switch - { - "claude-3-5-sonnet-latest" => CreateMessageRequestModel.Claude35SonnetLatest, - "claude-3-5-sonnet-20241022" => CreateMessageRequestModel.Claude35Sonnet20241022, - "claude-3-5-sonnet-20240620" => CreateMessageRequestModel.Claude35Sonnet20240620, - "claude-3-opus-latest" => CreateMessageRequestModel.Claude3OpusLatest, - "claude-3-opus-20240229" => CreateMessageRequestModel.Claude3Opus20240229, - "claude-3-sonnet-20240229" => CreateMessageRequestModel.Claude3Sonnet20240229, - "claude-3-haiku-20240307" => CreateMessageRequestModel.Claude3Haiku20240307, - "claude-2.1" => CreateMessageRequestModel.Claude21, - "claude-2.0" => CreateMessageRequestModel.Claude20, - _ => null, - }; - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Block.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Delta.Json.g.cs similarity index 89% rename from src/libs/Anthropic/Generated/Anthropic.Models.Block.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Delta.Json.g.cs index 3901392..876fffa 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Block.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Delta.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public readonly partial struct Block + public readonly partial struct Delta { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.Block? FromJson( + public static global::Anthropic.Delta? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.Block), - jsonSerializerContext) as global::Anthropic.Block?; + typeof(global::Anthropic.Delta), + jsonSerializerContext) as global::Anthropic.Delta?; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.Block? FromJson( + public static global::Anthropic.Delta? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.Block), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Block?; + typeof(global::Anthropic.Delta), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Delta?; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Delta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Delta.g.cs new file mode 100644 index 0000000..5482779 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Delta.g.cs @@ -0,0 +1,222 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct Delta : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaTextContentBlockDelta? TextDelta { get; init; } +#else + public global::Anthropic.BetaTextContentBlockDelta? TextDelta { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(TextDelta))] +#endif + public bool IsTextDelta => TextDelta != null; + + /// + /// + /// + public static implicit operator Delta(global::Anthropic.BetaTextContentBlockDelta value) => new Delta(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaTextContentBlockDelta?(Delta @this) => @this.TextDelta; + + /// + /// + /// + public Delta(global::Anthropic.BetaTextContentBlockDelta? value) + { + TextDelta = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaInputJsonContentBlockDelta? InputJsonDelta { get; init; } +#else + public global::Anthropic.BetaInputJsonContentBlockDelta? InputJsonDelta { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(InputJsonDelta))] +#endif + public bool IsInputJsonDelta => InputJsonDelta != null; + + /// + /// + /// + public static implicit operator Delta(global::Anthropic.BetaInputJsonContentBlockDelta value) => new Delta(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaInputJsonContentBlockDelta?(Delta @this) => @this.InputJsonDelta; + + /// + /// + /// + public Delta(global::Anthropic.BetaInputJsonContentBlockDelta? value) + { + InputJsonDelta = value; + } + + /// + /// + /// + public Delta( + global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType? type, + global::Anthropic.BetaTextContentBlockDelta? textDelta, + global::Anthropic.BetaInputJsonContentBlockDelta? inputJsonDelta + ) + { + Type = type; + + TextDelta = textDelta; + InputJsonDelta = inputJsonDelta; + } + + /// + /// + /// + public object? Object => + InputJsonDelta as object ?? + TextDelta as object + ; + + /// + /// + /// + public bool Validate() + { + return IsTextDelta && !IsInputJsonDelta || !IsTextDelta && IsInputJsonDelta; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? textDelta = null, + global::System.Func? inputJsonDelta = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsTextDelta && textDelta != null) + { + return textDelta(TextDelta!); + } + else if (IsInputJsonDelta && inputJsonDelta != null) + { + return inputJsonDelta(InputJsonDelta!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? textDelta = null, + global::System.Action? inputJsonDelta = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsTextDelta) + { + textDelta?.Invoke(TextDelta!); + } + else if (IsInputJsonDelta) + { + inputJsonDelta?.Invoke(InputJsonDelta!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + TextDelta, + typeof(global::Anthropic.BetaTextContentBlockDelta), + InputJsonDelta, + typeof(global::Anthropic.BetaInputJsonContentBlockDelta), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(Delta other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(TextDelta, other.TextDelta) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(InputJsonDelta, other.InputJsonDelta) + ; + } + + /// + /// + /// + public static bool operator ==(Delta obj1, Delta obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(Delta obj1, Delta obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is Delta o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Delta2.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Delta2.Json.g.cs new file mode 100644 index 0000000..b9c682b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Delta2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct Delta2 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.Delta2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.Delta2), + jsonSerializerContext) as global::Anthropic.Delta2?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.Delta2? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.Delta2), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Delta2?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDelta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Delta2.g.cs similarity index 64% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDelta.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Delta2.g.cs index 1d22bf2..c965a99 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDelta.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Delta2.g.cs @@ -5,22 +5,22 @@ namespace Anthropic { /// - /// A delta in a streaming message. + /// /// - public readonly partial struct BlockDelta : global::System.IEquatable + public readonly partial struct Delta2 : global::System.IEquatable { /// /// /// - public global::Anthropic.BlockDeltaDiscriminatorType? Type { get; } + public global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType? Type { get; } /// - /// A delta in a streaming text block. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.TextBlockDelta? TextDelta { get; init; } + public global::Anthropic.TextContentBlockDelta? TextDelta { get; init; } #else - public global::Anthropic.TextBlockDelta? TextDelta { get; } + public global::Anthropic.TextContentBlockDelta? TextDelta { get; } #endif /// @@ -34,28 +34,28 @@ namespace Anthropic /// /// /// - public static implicit operator BlockDelta(global::Anthropic.TextBlockDelta value) => new BlockDelta(value); + public static implicit operator Delta2(global::Anthropic.TextContentBlockDelta value) => new Delta2(value); /// /// /// - public static implicit operator global::Anthropic.TextBlockDelta?(BlockDelta @this) => @this.TextDelta; + public static implicit operator global::Anthropic.TextContentBlockDelta?(Delta2 @this) => @this.TextDelta; /// /// /// - public BlockDelta(global::Anthropic.TextBlockDelta? value) + public Delta2(global::Anthropic.TextContentBlockDelta? value) { TextDelta = value; } /// - /// A delta in a streaming input JSON. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.InputJsonBlockDelta? InputJsonDelta { get; init; } + public global::Anthropic.InputJsonContentBlockDelta? InputJsonDelta { get; init; } #else - public global::Anthropic.InputJsonBlockDelta? InputJsonDelta { get; } + public global::Anthropic.InputJsonContentBlockDelta? InputJsonDelta { get; } #endif /// @@ -69,17 +69,17 @@ public BlockDelta(global::Anthropic.TextBlockDelta? value) /// /// /// - public static implicit operator BlockDelta(global::Anthropic.InputJsonBlockDelta value) => new BlockDelta(value); + public static implicit operator Delta2(global::Anthropic.InputJsonContentBlockDelta value) => new Delta2(value); /// /// /// - public static implicit operator global::Anthropic.InputJsonBlockDelta?(BlockDelta @this) => @this.InputJsonDelta; + public static implicit operator global::Anthropic.InputJsonContentBlockDelta?(Delta2 @this) => @this.InputJsonDelta; /// /// /// - public BlockDelta(global::Anthropic.InputJsonBlockDelta? value) + public Delta2(global::Anthropic.InputJsonContentBlockDelta? value) { InputJsonDelta = value; } @@ -87,10 +87,10 @@ public BlockDelta(global::Anthropic.InputJsonBlockDelta? value) /// /// /// - public BlockDelta( - global::Anthropic.BlockDeltaDiscriminatorType? type, - global::Anthropic.TextBlockDelta? textDelta, - global::Anthropic.InputJsonBlockDelta? inputJsonDelta + public Delta2( + global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType? type, + global::Anthropic.TextContentBlockDelta? textDelta, + global::Anthropic.InputJsonContentBlockDelta? inputJsonDelta ) { Type = type; @@ -119,8 +119,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? textDelta = null, - global::System.Func? inputJsonDelta = null, + global::System.Func? textDelta = null, + global::System.Func? inputJsonDelta = null, bool validate = true) { if (validate) @@ -144,8 +144,8 @@ public bool Validate() /// /// public void Match( - global::System.Action? textDelta = null, - global::System.Action? inputJsonDelta = null, + global::System.Action? textDelta = null, + global::System.Action? inputJsonDelta = null, bool validate = true) { if (validate) @@ -171,9 +171,9 @@ public override int GetHashCode() var fields = new object?[] { TextDelta, - typeof(global::Anthropic.TextBlockDelta), + typeof(global::Anthropic.TextContentBlockDelta), InputJsonDelta, - typeof(global::Anthropic.InputJsonBlockDelta), + typeof(global::Anthropic.InputJsonContentBlockDelta), }; const int offset = unchecked((int)2166136261); const int prime = 16777619; @@ -187,26 +187,26 @@ static int HashCodeAggregator(int hashCode, object? value) => value == null /// /// /// - public bool Equals(BlockDelta other) + public bool Equals(Delta2 other) { return - global::System.Collections.Generic.EqualityComparer.Default.Equals(TextDelta, other.TextDelta) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(InputJsonDelta, other.InputJsonDelta) + global::System.Collections.Generic.EqualityComparer.Default.Equals(TextDelta, other.TextDelta) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(InputJsonDelta, other.InputJsonDelta) ; } /// /// /// - public static bool operator ==(BlockDelta obj1, BlockDelta obj2) + public static bool operator ==(Delta2 obj1, Delta2 obj2) { - return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); } /// /// /// - public static bool operator !=(BlockDelta obj1, BlockDelta obj2) + public static bool operator !=(Delta2 obj1, Delta2 obj2) { return !(obj1 == obj2); } @@ -216,7 +216,7 @@ public bool Equals(BlockDelta other) /// public override bool Equals(object? obj) { - return obj is BlockDelta o && Equals(o); + return obj is Delta2 o && Equals(o); } } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Error.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Error.Json.g.cs index 9fad4f9..3cc80a0 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Error.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Error.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class Error + public readonly partial struct Error { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -41,7 +41,7 @@ public string ToJson( return global::System.Text.Json.JsonSerializer.Deserialize( json, typeof(global::Anthropic.Error), - jsonSerializerContext) as global::Anthropic.Error; + jsonSerializerContext) as global::Anthropic.Error?; } /// @@ -70,7 +70,7 @@ public string ToJson( return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, typeof(global::Anthropic.Error), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Error; + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Error?; } /// diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Error.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Error.g.cs index 0a654f5..3d70536 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Error.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Error.g.cs @@ -1,56 +1,477 @@ +#pragma warning disable CS0618 // Type or member is obsolete #nullable enable namespace Anthropic { /// - /// An error object. + /// /// - public sealed partial class Error + public readonly partial struct Error : global::System.IEquatable { /// - /// The type of error. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Type { get; set; } + public global::Anthropic.BetaErrorResponseErrorDiscriminatorType? Type { get; } /// - /// A human-readable error message. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("message")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Message { get; set; } +#if NET6_0_OR_GREATER + public global::Anthropic.BetaInvalidRequestError? InvalidRequestError { get; init; } +#else + public global::Anthropic.BetaInvalidRequestError? InvalidRequestError { get; } +#endif /// - /// Additional properties that are not explicitly defined in the schema + /// /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(InvalidRequestError))] +#endif + public bool IsInvalidRequestError => InvalidRequestError != null; /// - /// Initializes a new instance of the class. + /// + /// + public static implicit operator Error(global::Anthropic.BetaInvalidRequestError value) => new Error(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaInvalidRequestError?(Error @this) => @this.InvalidRequestError; + + /// + /// + /// + public Error(global::Anthropic.BetaInvalidRequestError? value) + { + InvalidRequestError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaAuthenticationError? AuthenticationError { get; init; } +#else + public global::Anthropic.BetaAuthenticationError? AuthenticationError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(AuthenticationError))] +#endif + public bool IsAuthenticationError => AuthenticationError != null; + + /// + /// + /// + public static implicit operator Error(global::Anthropic.BetaAuthenticationError value) => new Error(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaAuthenticationError?(Error @this) => @this.AuthenticationError; + + /// + /// + /// + public Error(global::Anthropic.BetaAuthenticationError? value) + { + AuthenticationError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaPermissionError? PermissionError { get; init; } +#else + public global::Anthropic.BetaPermissionError? PermissionError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(PermissionError))] +#endif + public bool IsPermissionError => PermissionError != null; + + /// + /// + /// + public static implicit operator Error(global::Anthropic.BetaPermissionError value) => new Error(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaPermissionError?(Error @this) => @this.PermissionError; + + /// + /// + /// + public Error(global::Anthropic.BetaPermissionError? value) + { + PermissionError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaNotFoundError? NotFoundError { get; init; } +#else + public global::Anthropic.BetaNotFoundError? NotFoundError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(NotFoundError))] +#endif + public bool IsNotFoundError => NotFoundError != null; + + /// + /// + /// + public static implicit operator Error(global::Anthropic.BetaNotFoundError value) => new Error(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaNotFoundError?(Error @this) => @this.NotFoundError; + + /// + /// + /// + public Error(global::Anthropic.BetaNotFoundError? value) + { + NotFoundError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaRateLimitError? RateLimitError { get; init; } +#else + public global::Anthropic.BetaRateLimitError? RateLimitError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(RateLimitError))] +#endif + public bool IsRateLimitError => RateLimitError != null; + + /// + /// + /// + public static implicit operator Error(global::Anthropic.BetaRateLimitError value) => new Error(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaRateLimitError?(Error @this) => @this.RateLimitError; + + /// + /// + /// + public Error(global::Anthropic.BetaRateLimitError? value) + { + RateLimitError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaAPIError? ApiError { get; init; } +#else + public global::Anthropic.BetaAPIError? ApiError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ApiError))] +#endif + public bool IsApiError => ApiError != null; + + /// + /// + /// + public static implicit operator Error(global::Anthropic.BetaAPIError value) => new Error(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaAPIError?(Error @this) => @this.ApiError; + + /// + /// + /// + public Error(global::Anthropic.BetaAPIError? value) + { + ApiError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaOverloadedError? OverloadedError { get; init; } +#else + public global::Anthropic.BetaOverloadedError? OverloadedError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(OverloadedError))] +#endif + public bool IsOverloadedError => OverloadedError != null; + + /// + /// + /// + public static implicit operator Error(global::Anthropic.BetaOverloadedError value) => new Error(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaOverloadedError?(Error @this) => @this.OverloadedError; + + /// + /// + /// + public Error(global::Anthropic.BetaOverloadedError? value) + { + OverloadedError = value; + } + + /// + /// /// - /// - /// The type of error. - /// - /// - /// A human-readable error message. - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public Error( - string type, - string message) + global::Anthropic.BetaErrorResponseErrorDiscriminatorType? type, + global::Anthropic.BetaInvalidRequestError? invalidRequestError, + global::Anthropic.BetaAuthenticationError? authenticationError, + global::Anthropic.BetaPermissionError? permissionError, + global::Anthropic.BetaNotFoundError? notFoundError, + global::Anthropic.BetaRateLimitError? rateLimitError, + global::Anthropic.BetaAPIError? apiError, + global::Anthropic.BetaOverloadedError? overloadedError + ) + { + Type = type; + + InvalidRequestError = invalidRequestError; + AuthenticationError = authenticationError; + PermissionError = permissionError; + NotFoundError = notFoundError; + RateLimitError = rateLimitError; + ApiError = apiError; + OverloadedError = overloadedError; + } + + /// + /// + /// + public object? Object => + OverloadedError as object ?? + ApiError as object ?? + RateLimitError as object ?? + NotFoundError as object ?? + PermissionError as object ?? + AuthenticationError as object ?? + InvalidRequestError as object + ; + + /// + /// + /// + public bool Validate() + { + return IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && IsOverloadedError; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? invalidRequestError = null, + global::System.Func? authenticationError = null, + global::System.Func? permissionError = null, + global::System.Func? notFoundError = null, + global::System.Func? rateLimitError = null, + global::System.Func? apiError = null, + global::System.Func? overloadedError = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsInvalidRequestError && invalidRequestError != null) + { + return invalidRequestError(InvalidRequestError!); + } + else if (IsAuthenticationError && authenticationError != null) + { + return authenticationError(AuthenticationError!); + } + else if (IsPermissionError && permissionError != null) + { + return permissionError(PermissionError!); + } + else if (IsNotFoundError && notFoundError != null) + { + return notFoundError(NotFoundError!); + } + else if (IsRateLimitError && rateLimitError != null) + { + return rateLimitError(RateLimitError!); + } + else if (IsApiError && apiError != null) + { + return apiError(ApiError!); + } + else if (IsOverloadedError && overloadedError != null) + { + return overloadedError(OverloadedError!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? invalidRequestError = null, + global::System.Action? authenticationError = null, + global::System.Action? permissionError = null, + global::System.Action? notFoundError = null, + global::System.Action? rateLimitError = null, + global::System.Action? apiError = null, + global::System.Action? overloadedError = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsInvalidRequestError) + { + invalidRequestError?.Invoke(InvalidRequestError!); + } + else if (IsAuthenticationError) + { + authenticationError?.Invoke(AuthenticationError!); + } + else if (IsPermissionError) + { + permissionError?.Invoke(PermissionError!); + } + else if (IsNotFoundError) + { + notFoundError?.Invoke(NotFoundError!); + } + else if (IsRateLimitError) + { + rateLimitError?.Invoke(RateLimitError!); + } + else if (IsApiError) + { + apiError?.Invoke(ApiError!); + } + else if (IsOverloadedError) + { + overloadedError?.Invoke(OverloadedError!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + InvalidRequestError, + typeof(global::Anthropic.BetaInvalidRequestError), + AuthenticationError, + typeof(global::Anthropic.BetaAuthenticationError), + PermissionError, + typeof(global::Anthropic.BetaPermissionError), + NotFoundError, + typeof(global::Anthropic.BetaNotFoundError), + RateLimitError, + typeof(global::Anthropic.BetaRateLimitError), + ApiError, + typeof(global::Anthropic.BetaAPIError), + OverloadedError, + typeof(global::Anthropic.BetaOverloadedError), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(Error other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(InvalidRequestError, other.InvalidRequestError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(AuthenticationError, other.AuthenticationError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(PermissionError, other.PermissionError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(NotFoundError, other.NotFoundError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(RateLimitError, other.RateLimitError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ApiError, other.ApiError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(OverloadedError, other.OverloadedError) + ; + } + + /// + /// + /// + public static bool operator ==(Error obj1, Error obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(Error obj1, Error obj2) { - this.Type = type ?? throw new global::System.ArgumentNullException(nameof(type)); - this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + return !(obj1 == obj2); } /// - /// Initializes a new instance of the class. + /// /// - public Error() + public override bool Equals(object? obj) { + return obj is Error o && Equals(o); } } -} \ No newline at end of file +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Error2.Json.g.cs similarity index 90% rename from src/libs/Anthropic/Generated/Anthropic.Models.ErrorEvent.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Error2.Json.g.cs index 8034856..2577d18 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorEvent.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Error2.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ErrorEvent + public readonly partial struct Error2 { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ErrorEvent? FromJson( + public static global::Anthropic.Error2? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ErrorEvent), - jsonSerializerContext) as global::Anthropic.ErrorEvent; + typeof(global::Anthropic.Error2), + jsonSerializerContext) as global::Anthropic.Error2?; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ErrorEvent? FromJson( + public static global::Anthropic.Error2? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ErrorEvent), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ErrorEvent; + typeof(global::Anthropic.Error2), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Error2?; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Error2.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Error2.g.cs new file mode 100644 index 0000000..eaeb5fe --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Error2.g.cs @@ -0,0 +1,477 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct Error2 : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.ErrorResponseErrorDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.InvalidRequestError? InvalidRequestError { get; init; } +#else + public global::Anthropic.InvalidRequestError? InvalidRequestError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(InvalidRequestError))] +#endif + public bool IsInvalidRequestError => InvalidRequestError != null; + + /// + /// + /// + public static implicit operator Error2(global::Anthropic.InvalidRequestError value) => new Error2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.InvalidRequestError?(Error2 @this) => @this.InvalidRequestError; + + /// + /// + /// + public Error2(global::Anthropic.InvalidRequestError? value) + { + InvalidRequestError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.AuthenticationError? AuthenticationError { get; init; } +#else + public global::Anthropic.AuthenticationError? AuthenticationError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(AuthenticationError))] +#endif + public bool IsAuthenticationError => AuthenticationError != null; + + /// + /// + /// + public static implicit operator Error2(global::Anthropic.AuthenticationError value) => new Error2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.AuthenticationError?(Error2 @this) => @this.AuthenticationError; + + /// + /// + /// + public Error2(global::Anthropic.AuthenticationError? value) + { + AuthenticationError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PermissionError? PermissionError { get; init; } +#else + public global::Anthropic.PermissionError? PermissionError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(PermissionError))] +#endif + public bool IsPermissionError => PermissionError != null; + + /// + /// + /// + public static implicit operator Error2(global::Anthropic.PermissionError value) => new Error2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PermissionError?(Error2 @this) => @this.PermissionError; + + /// + /// + /// + public Error2(global::Anthropic.PermissionError? value) + { + PermissionError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.NotFoundError? NotFoundError { get; init; } +#else + public global::Anthropic.NotFoundError? NotFoundError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(NotFoundError))] +#endif + public bool IsNotFoundError => NotFoundError != null; + + /// + /// + /// + public static implicit operator Error2(global::Anthropic.NotFoundError value) => new Error2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.NotFoundError?(Error2 @this) => @this.NotFoundError; + + /// + /// + /// + public Error2(global::Anthropic.NotFoundError? value) + { + NotFoundError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.RateLimitError? RateLimitError { get; init; } +#else + public global::Anthropic.RateLimitError? RateLimitError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(RateLimitError))] +#endif + public bool IsRateLimitError => RateLimitError != null; + + /// + /// + /// + public static implicit operator Error2(global::Anthropic.RateLimitError value) => new Error2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.RateLimitError?(Error2 @this) => @this.RateLimitError; + + /// + /// + /// + public Error2(global::Anthropic.RateLimitError? value) + { + RateLimitError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.APIError? ApiError { get; init; } +#else + public global::Anthropic.APIError? ApiError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ApiError))] +#endif + public bool IsApiError => ApiError != null; + + /// + /// + /// + public static implicit operator Error2(global::Anthropic.APIError value) => new Error2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.APIError?(Error2 @this) => @this.ApiError; + + /// + /// + /// + public Error2(global::Anthropic.APIError? value) + { + ApiError = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.OverloadedError? OverloadedError { get; init; } +#else + public global::Anthropic.OverloadedError? OverloadedError { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(OverloadedError))] +#endif + public bool IsOverloadedError => OverloadedError != null; + + /// + /// + /// + public static implicit operator Error2(global::Anthropic.OverloadedError value) => new Error2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.OverloadedError?(Error2 @this) => @this.OverloadedError; + + /// + /// + /// + public Error2(global::Anthropic.OverloadedError? value) + { + OverloadedError = value; + } + + /// + /// + /// + public Error2( + global::Anthropic.ErrorResponseErrorDiscriminatorType? type, + global::Anthropic.InvalidRequestError? invalidRequestError, + global::Anthropic.AuthenticationError? authenticationError, + global::Anthropic.PermissionError? permissionError, + global::Anthropic.NotFoundError? notFoundError, + global::Anthropic.RateLimitError? rateLimitError, + global::Anthropic.APIError? apiError, + global::Anthropic.OverloadedError? overloadedError + ) + { + Type = type; + + InvalidRequestError = invalidRequestError; + AuthenticationError = authenticationError; + PermissionError = permissionError; + NotFoundError = notFoundError; + RateLimitError = rateLimitError; + ApiError = apiError; + OverloadedError = overloadedError; + } + + /// + /// + /// + public object? Object => + OverloadedError as object ?? + ApiError as object ?? + RateLimitError as object ?? + NotFoundError as object ?? + PermissionError as object ?? + AuthenticationError as object ?? + InvalidRequestError as object + ; + + /// + /// + /// + public bool Validate() + { + return IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && IsNotFoundError && !IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && IsRateLimitError && !IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && IsApiError && !IsOverloadedError || !IsInvalidRequestError && !IsAuthenticationError && !IsPermissionError && !IsNotFoundError && !IsRateLimitError && !IsApiError && IsOverloadedError; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? invalidRequestError = null, + global::System.Func? authenticationError = null, + global::System.Func? permissionError = null, + global::System.Func? notFoundError = null, + global::System.Func? rateLimitError = null, + global::System.Func? apiError = null, + global::System.Func? overloadedError = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsInvalidRequestError && invalidRequestError != null) + { + return invalidRequestError(InvalidRequestError!); + } + else if (IsAuthenticationError && authenticationError != null) + { + return authenticationError(AuthenticationError!); + } + else if (IsPermissionError && permissionError != null) + { + return permissionError(PermissionError!); + } + else if (IsNotFoundError && notFoundError != null) + { + return notFoundError(NotFoundError!); + } + else if (IsRateLimitError && rateLimitError != null) + { + return rateLimitError(RateLimitError!); + } + else if (IsApiError && apiError != null) + { + return apiError(ApiError!); + } + else if (IsOverloadedError && overloadedError != null) + { + return overloadedError(OverloadedError!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? invalidRequestError = null, + global::System.Action? authenticationError = null, + global::System.Action? permissionError = null, + global::System.Action? notFoundError = null, + global::System.Action? rateLimitError = null, + global::System.Action? apiError = null, + global::System.Action? overloadedError = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsInvalidRequestError) + { + invalidRequestError?.Invoke(InvalidRequestError!); + } + else if (IsAuthenticationError) + { + authenticationError?.Invoke(AuthenticationError!); + } + else if (IsPermissionError) + { + permissionError?.Invoke(PermissionError!); + } + else if (IsNotFoundError) + { + notFoundError?.Invoke(NotFoundError!); + } + else if (IsRateLimitError) + { + rateLimitError?.Invoke(RateLimitError!); + } + else if (IsApiError) + { + apiError?.Invoke(ApiError!); + } + else if (IsOverloadedError) + { + overloadedError?.Invoke(OverloadedError!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + InvalidRequestError, + typeof(global::Anthropic.InvalidRequestError), + AuthenticationError, + typeof(global::Anthropic.AuthenticationError), + PermissionError, + typeof(global::Anthropic.PermissionError), + NotFoundError, + typeof(global::Anthropic.NotFoundError), + RateLimitError, + typeof(global::Anthropic.RateLimitError), + ApiError, + typeof(global::Anthropic.APIError), + OverloadedError, + typeof(global::Anthropic.OverloadedError), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(Error2 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(InvalidRequestError, other.InvalidRequestError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(AuthenticationError, other.AuthenticationError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(PermissionError, other.PermissionError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(NotFoundError, other.NotFoundError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(RateLimitError, other.RateLimitError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ApiError, other.ApiError) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(OverloadedError, other.OverloadedError) + ; + } + + /// + /// + /// + public static bool operator ==(Error2 obj1, Error2 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(Error2 obj1, Error2 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is Error2 o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponse.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponse.Json.g.cs new file mode 100644 index 0000000..5b85444 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ErrorResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ErrorResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ErrorResponse), + jsonSerializerContext) as global::Anthropic.ErrorResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ErrorResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ErrorResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ErrorResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponse.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponse.g.cs new file mode 100644 index 0000000..a3177a2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponse.g.cs @@ -0,0 +1,56 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class ErrorResponse + { + /// + /// Default Value: error + /// + /// global::Anthropic.ErrorResponseType.Error + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ErrorResponseTypeJsonConverter))] + public global::Anthropic.ErrorResponseType Type { get; set; } = global::Anthropic.ErrorResponseType.Error; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("error")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.Error2JsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Error2 Error { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: error + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ErrorResponse( + global::Anthropic.Error2 error, + global::Anthropic.ErrorResponseType type = global::Anthropic.ErrorResponseType.Error) + { + this.Error = error; + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public ErrorResponse() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminator.Json.g.cs new file mode 100644 index 0000000..e461533 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ErrorResponseErrorDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ErrorResponseErrorDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ErrorResponseErrorDiscriminator), + jsonSerializerContext) as global::Anthropic.ErrorResponseErrorDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ErrorResponseErrorDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ErrorResponseErrorDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ErrorResponseErrorDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminator.g.cs new file mode 100644 index 0000000..744fb80 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class ErrorResponseErrorDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ErrorResponseErrorDiscriminatorTypeJsonConverter))] + public global::Anthropic.ErrorResponseErrorDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ErrorResponseErrorDiscriminator( + global::Anthropic.ErrorResponseErrorDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public ErrorResponseErrorDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminatorType.g.cs new file mode 100644 index 0000000..bc48e43 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseErrorDiscriminatorType.g.cs @@ -0,0 +1,81 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ErrorResponseErrorDiscriminatorType + { + /// + /// + /// + ApiError, + /// + /// + /// + AuthenticationError, + /// + /// + /// + InvalidRequestError, + /// + /// + /// + NotFoundError, + /// + /// + /// + OverloadedError, + /// + /// + /// + PermissionError, + /// + /// + /// + RateLimitError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ErrorResponseErrorDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ErrorResponseErrorDiscriminatorType value) + { + return value switch + { + ErrorResponseErrorDiscriminatorType.ApiError => "api_error", + ErrorResponseErrorDiscriminatorType.AuthenticationError => "authentication_error", + ErrorResponseErrorDiscriminatorType.InvalidRequestError => "invalid_request_error", + ErrorResponseErrorDiscriminatorType.NotFoundError => "not_found_error", + ErrorResponseErrorDiscriminatorType.OverloadedError => "overloaded_error", + ErrorResponseErrorDiscriminatorType.PermissionError => "permission_error", + ErrorResponseErrorDiscriminatorType.RateLimitError => "rate_limit_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ErrorResponseErrorDiscriminatorType? ToEnum(string value) + { + return value switch + { + "api_error" => ErrorResponseErrorDiscriminatorType.ApiError, + "authentication_error" => ErrorResponseErrorDiscriminatorType.AuthenticationError, + "invalid_request_error" => ErrorResponseErrorDiscriminatorType.InvalidRequestError, + "not_found_error" => ErrorResponseErrorDiscriminatorType.NotFoundError, + "overloaded_error" => ErrorResponseErrorDiscriminatorType.OverloadedError, + "permission_error" => ErrorResponseErrorDiscriminatorType.PermissionError, + "rate_limit_error" => ErrorResponseErrorDiscriminatorType.RateLimitError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseType.g.cs new file mode 100644 index 0000000..26ad9b2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ErrorResponseType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: error + /// + public enum ErrorResponseType + { + /// + /// + /// + Error, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ErrorResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ErrorResponseType value) + { + return value switch + { + ErrorResponseType.Error => "error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ErrorResponseType? ToEnum(string value) + { + return value switch + { + "error" => ErrorResponseType.Error, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDelta.Json.g.cs new file mode 100644 index 0000000..dc0d085 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDelta.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class InputJsonContentBlockDelta + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.InputJsonContentBlockDelta? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.InputJsonContentBlockDelta), + jsonSerializerContext) as global::Anthropic.InputJsonContentBlockDelta; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.InputJsonContentBlockDelta? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.InputJsonContentBlockDelta), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.InputJsonContentBlockDelta; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonBlockDelta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDelta.g.cs similarity index 54% rename from src/libs/Anthropic/Generated/Anthropic.Models.InputJsonBlockDelta.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDelta.g.cs index b3ce2c6..9814e60 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonBlockDelta.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDelta.g.cs @@ -4,24 +4,24 @@ namespace Anthropic { /// - /// A delta in a streaming input JSON. + /// /// - public sealed partial class InputJsonBlockDelta + public sealed partial class InputJsonContentBlockDelta { /// - /// The partial JSON delta. + /// Default Value: input_json_delta /// - [global::System.Text.Json.Serialization.JsonPropertyName("partial_json")] - public string? PartialJson { get; set; } + /// global::Anthropic.InputJsonContentBlockDeltaType.InputJsonDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.InputJsonContentBlockDeltaTypeJsonConverter))] + public global::Anthropic.InputJsonContentBlockDeltaType Type { get; set; } = global::Anthropic.InputJsonContentBlockDeltaType.InputJsonDelta; /// - /// The type of content block.
- /// Default Value: input_json_delta + /// ///
- /// "input_json_delta" - [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonPropertyName("partial_json")] [global::System.Text.Json.Serialization.JsonRequired] - public required string Type { get; set; } = "input_json_delta"; + public required string PartialJson { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -30,28 +30,25 @@ public sealed partial class InputJsonBlockDelta public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The partial JSON delta. - /// /// - /// The type of content block.
/// Default Value: input_json_delta /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public InputJsonBlockDelta( - string type, - string? partialJson) + public InputJsonContentBlockDelta( + string partialJson, + global::Anthropic.InputJsonContentBlockDeltaType type = global::Anthropic.InputJsonContentBlockDeltaType.InputJsonDelta) { - this.Type = type ?? throw new global::System.ArgumentNullException(nameof(type)); - this.PartialJson = partialJson; + this.PartialJson = partialJson ?? throw new global::System.ArgumentNullException(nameof(partialJson)); + this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public InputJsonBlockDelta() + public InputJsonContentBlockDelta() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDeltaType.g.cs new file mode 100644 index 0000000..bdd7084 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonContentBlockDeltaType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: input_json_delta + /// + public enum InputJsonContentBlockDeltaType + { + /// + /// + /// + InputJsonDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class InputJsonContentBlockDeltaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this InputJsonContentBlockDeltaType value) + { + return value switch + { + InputJsonContentBlockDeltaType.InputJsonDelta => "input_json_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static InputJsonContentBlockDeltaType? ToEnum(string value) + { + return value switch + { + "input_json_delta" => InputJsonContentBlockDeltaType.InputJsonDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputMessage.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessage.Json.g.cs new file mode 100644 index 0000000..264afb2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class InputMessage + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.InputMessage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.InputMessage), + jsonSerializerContext) as global::Anthropic.InputMessage; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.InputMessage? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.InputMessage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.InputMessage; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputMessage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessage.g.cs new file mode 100644 index 0000000..f0278ed --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessage.g.cs @@ -0,0 +1,56 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class InputMessage + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("role")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.InputMessageRoleJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.InputMessageRole Role { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.AnyOf> Content { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputMessage( + global::Anthropic.InputMessageRole role, + global::Anthropic.AnyOf> content) + { + this.Role = role; + this.Content = content; + } + + /// + /// Initializes a new instance of the class. + /// + public InputMessage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminator.Json.g.cs new file mode 100644 index 0000000..0ba7670 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class InputMessageContentVariant2ItemDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.InputMessageContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.InputMessageContentVariant2ItemDiscriminator), + jsonSerializerContext) as global::Anthropic.InputMessageContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.InputMessageContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.InputMessageContentVariant2ItemDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.InputMessageContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminator.g.cs new file mode 100644 index 0000000..74facfe --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class InputMessageContentVariant2ItemDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.InputMessageContentVariant2ItemDiscriminatorTypeJsonConverter))] + public global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputMessageContentVariant2ItemDiscriminator( + global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public InputMessageContentVariant2ItemDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..9713636 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum InputMessageContentVariant2ItemDiscriminatorType + { + /// + /// + /// + Image, + /// + /// + /// + Text, + /// + /// + /// + ToolResult, + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class InputMessageContentVariant2ItemDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this InputMessageContentVariant2ItemDiscriminatorType value) + { + return value switch + { + InputMessageContentVariant2ItemDiscriminatorType.Image => "image", + InputMessageContentVariant2ItemDiscriminatorType.Text => "text", + InputMessageContentVariant2ItemDiscriminatorType.ToolResult => "tool_result", + InputMessageContentVariant2ItemDiscriminatorType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static InputMessageContentVariant2ItemDiscriminatorType? ToEnum(string value) + { + return value switch + { + "image" => InputMessageContentVariant2ItemDiscriminatorType.Image, + "text" => InputMessageContentVariant2ItemDiscriminatorType.Text, + "tool_result" => InputMessageContentVariant2ItemDiscriminatorType.ToolResult, + "tool_use" => InputMessageContentVariant2ItemDiscriminatorType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageRole.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageRole.g.cs new file mode 100644 index 0000000..406970c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputMessageRole.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum InputMessageRole + { + /// + /// + /// + User, + /// + /// + /// + Assistant, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class InputMessageRoleExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this InputMessageRole value) + { + return value switch + { + InputMessageRole.User => "user", + InputMessageRole.Assistant => "assistant", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static InputMessageRole? ToEnum(string value) + { + return value switch + { + "user" => InputMessageRole.User, + "assistant" => InputMessageRole.Assistant, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchema.Json.g.cs similarity index 88% rename from src/libs/Anthropic/Generated/Anthropic.Models.ImageBlock.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.InputSchema.Json.g.cs index a2b42fd..7384e54 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlock.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchema.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ImageBlock + public sealed partial class InputSchema { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ImageBlock? FromJson( + public static global::Anthropic.InputSchema? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ImageBlock), - jsonSerializerContext) as global::Anthropic.ImageBlock; + typeof(global::Anthropic.InputSchema), + jsonSerializerContext) as global::Anthropic.InputSchema; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ImageBlock? FromJson( + public static global::Anthropic.InputSchema? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ImageBlock), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ImageBlock; + typeof(global::Anthropic.InputSchema), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.InputSchema; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputSchema.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchema.g.cs new file mode 100644 index 0000000..ebc6960 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchema.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class InputSchema + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.InputSchemaTypeJsonConverter))] + public global::Anthropic.InputSchemaType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("properties")] + public object? Properties { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputSchema( + global::Anthropic.InputSchemaType type, + object? properties) + { + this.Type = type; + this.Properties = properties; + } + + /// + /// Initializes a new instance of the class. + /// + public InputSchema() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonBlockDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaProperties.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.InputJsonBlockDelta.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaProperties.Json.g.cs index 0097237..ed5d842 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.InputJsonBlockDelta.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaProperties.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class InputJsonBlockDelta + public sealed partial class InputSchemaProperties { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.InputJsonBlockDelta? FromJson( + public static global::Anthropic.InputSchemaProperties? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.InputJsonBlockDelta), - jsonSerializerContext) as global::Anthropic.InputJsonBlockDelta; + typeof(global::Anthropic.InputSchemaProperties), + jsonSerializerContext) as global::Anthropic.InputSchemaProperties; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.InputJsonBlockDelta? FromJson( + public static global::Anthropic.InputSchemaProperties? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.InputJsonBlockDelta), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.InputJsonBlockDelta; + typeof(global::Anthropic.InputSchemaProperties), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.InputSchemaProperties; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaProperties.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaProperties.g.cs new file mode 100644 index 0000000..0b5fccc --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaProperties.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class InputSchemaProperties + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputSchemaProperties( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaType.g.cs new file mode 100644 index 0000000..8ffb3a4 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InputSchemaType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum InputSchemaType + { + /// + /// + /// + Object, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class InputSchemaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this InputSchemaType value) + { + return value switch + { + InputSchemaType.Object => "object", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static InputSchemaType? ToEnum(string value) + { + return value switch + { + "object" => InputSchemaType.Object, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestError.Json.g.cs new file mode 100644 index 0000000..a86acf3 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class InvalidRequestError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.InvalidRequestError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.InvalidRequestError), + jsonSerializerContext) as global::Anthropic.InvalidRequestError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.InvalidRequestError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.InvalidRequestError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.InvalidRequestError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestError.g.cs new file mode 100644 index 0000000..57b8c02 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class InvalidRequestError + { + /// + /// Default Value: invalid_request_error + /// + /// global::Anthropic.InvalidRequestErrorType.InvalidRequestError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.InvalidRequestErrorTypeJsonConverter))] + public global::Anthropic.InvalidRequestErrorType Type { get; set; } = global::Anthropic.InvalidRequestErrorType.InvalidRequestError; + + /// + /// Default Value: Invalid request + /// + /// "Invalid request" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Invalid request"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: invalid_request_error + /// + /// + /// Default Value: Invalid request + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InvalidRequestError( + string message, + global::Anthropic.InvalidRequestErrorType type = global::Anthropic.InvalidRequestErrorType.InvalidRequestError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public InvalidRequestError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestErrorType.g.cs new file mode 100644 index 0000000..bee3e39 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.InvalidRequestErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: invalid_request_error + /// + public enum InvalidRequestErrorType + { + /// + /// + /// + InvalidRequestError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class InvalidRequestErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this InvalidRequestErrorType value) + { + return value switch + { + InvalidRequestErrorType.InvalidRequestError => "invalid_request_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static InvalidRequestErrorType? ToEnum(string value) + { + return value switch + { + "invalid_request_error" => InvalidRequestErrorType.InvalidRequestError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Message.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Message.g.cs index c0e07c3..76c217a 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Message.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Message.g.cs @@ -1,86 +1,108 @@ -#pragma warning disable CS0618 // Type or member is obsolete - #nullable enable namespace Anthropic { /// - /// A message in a chat conversation. + /// /// public sealed partial class Message { /// /// Unique object identifier.
- /// The format and length of IDs may change over time. + /// The format and length of IDs may change over time.
+ /// Example: msg_013Zva2CMHLNnXjNJJKqJ2EF ///
+ /// msg_013Zva2CMHLNnXjNJJKqJ2EF [global::System.Text.Json.Serialization.JsonPropertyName("id")] - public string? Id { get; set; } + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } /// - /// The content of the message. + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message ///
- [global::System.Text.Json.Serialization.JsonPropertyName("content")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.OneOfJsonConverter>))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.OneOf> Content { get; set; } + /// global::Anthropic.MessageType.Message + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageTypeJsonConverter))] + public global::Anthropic.MessageType Type { get; set; } = global::Anthropic.MessageType.Message; /// - /// The role of the messages author. + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant ///
+ /// global::Anthropic.MessageRole.Assistant [global::System.Text.Json.Serialization.JsonPropertyName("role")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageRoleJsonConverter))] + public global::Anthropic.MessageRole Role { get; set; } = global::Anthropic.MessageRole.Assistant; + + /// + /// Content generated by the model.
+ /// This is an array of content blocks, each of which has a `type` that determines its shape.
+ /// Example:
+ /// ```json
+ /// [{"type": "text", "text": "Hi, I'm Claude."}]
+ /// ```
+ /// If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.
+ /// For example, if the input `messages` were:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("}
+ /// ]
+ /// ```
+ /// Then the response `content` might be:
+ /// ```json
+ /// [{"type": "text", "text": "B)"}]
+ /// ```
+ /// Example: [] + ///
+ /// [] + [global::System.Text.Json.Serialization.JsonPropertyName("content")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageRole Role { get; set; } + public required global::System.Collections.Generic.IList Content { get; set; } /// - /// The model that handled the request. + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. /// [global::System.Text.Json.Serialization.JsonPropertyName("model")] - public string? Model { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } /// /// The reason that we stopped.
/// This may be one the following values:
- /// - `"end_turn"`: the model reached a natural stopping point
- /// - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
- /// - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
- /// - `"tool_use"`: the model invoked one or more tools
- /// In non-streaming mode this value is always non-null. In streaming mode, it is
- /// null in the `message_start` event and non-null otherwise. + /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. ///
[global::System.Text.Json.Serialization.JsonPropertyName("stop_reason")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.StopReasonJsonConverter))] - public global::Anthropic.StopReason? StopReason { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStopReasonJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.MessageStopReason? StopReason { get; set; } /// /// Which custom stop sequence was generated, if any.
- /// This value will be a non-null string if one of your custom stop sequences was
- /// generated. + /// This value will be a non-null string if one of your custom stop sequences was generated. ///
[global::System.Text.Json.Serialization.JsonPropertyName("stop_sequence")] - public string? StopSequence { get; set; } - - /// - /// Object type.
- /// For Messages, this is always `"message"`. - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("type")] - public string? Type { get; set; } + [global::System.Text.Json.Serialization.JsonRequired] + public required string? StopSequence { get; set; } /// /// Billing and rate-limit usage.
- /// Anthropic's API bills and rate-limits by token counts, as tokens represent the
- /// underlying cost to our systems.
- /// Under the hood, the API transforms requests into a format suitable for the
- /// model. The model's output then goes through a parsing stage before becoming an
- /// API response. As a result, the token counts in `usage` will not match one-to-one
- /// with the exact visible content of an API request or response.
- /// For example, `output_tokens` will be non-zero, even for an empty string response
- /// from Claude. + /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. ///
[global::System.Text.Json.Serialization.JsonPropertyName("usage")] - public global::Anthropic.Usage? Usage { get; set; } + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Usage Usage { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -93,66 +115,81 @@ public sealed partial class Message /// /// /// Unique object identifier.
- /// The format and length of IDs may change over time. + /// The format and length of IDs may change over time.
+ /// Example: msg_013Zva2CMHLNnXjNJJKqJ2EF /// - /// - /// The content of the message. + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message /// /// - /// The role of the messages author. + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant + /// + /// + /// Content generated by the model.
+ /// This is an array of content blocks, each of which has a `type` that determines its shape.
+ /// Example:
+ /// ```json
+ /// [{"type": "text", "text": "Hi, I'm Claude."}]
+ /// ```
+ /// If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.
+ /// For example, if the input `messages` were:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("}
+ /// ]
+ /// ```
+ /// Then the response `content` might be:
+ /// ```json
+ /// [{"type": "text", "text": "B)"}]
+ /// ```
+ /// Example: [] /// /// - /// The model that handled the request. + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. /// /// /// The reason that we stopped.
/// This may be one the following values:
- /// - `"end_turn"`: the model reached a natural stopping point
- /// - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
- /// - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
- /// - `"tool_use"`: the model invoked one or more tools
- /// In non-streaming mode this value is always non-null. In streaming mode, it is
- /// null in the `message_start` event and non-null otherwise. + /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. /// /// /// Which custom stop sequence was generated, if any.
- /// This value will be a non-null string if one of your custom stop sequences was
- /// generated. - /// - /// - /// Object type.
- /// For Messages, this is always `"message"`. + /// This value will be a non-null string if one of your custom stop sequences was generated. /// /// /// Billing and rate-limit usage.
- /// Anthropic's API bills and rate-limits by token counts, as tokens represent the
- /// underlying cost to our systems.
- /// Under the hood, the API transforms requests into a format suitable for the
- /// model. The model's output then goes through a parsing stage before becoming an
- /// API response. As a result, the token counts in `usage` will not match one-to-one
- /// with the exact visible content of an API request or response.
- /// For example, `output_tokens` will be non-zero, even for an empty string response
- /// from Claude. + /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public Message( - global::Anthropic.OneOf> content, - global::Anthropic.MessageRole role, - string? id, - string? model, - global::Anthropic.StopReason? stopReason, + string id, + global::System.Collections.Generic.IList content, + global::Anthropic.Model model, + global::Anthropic.MessageStopReason? stopReason, string? stopSequence, - string? type, - global::Anthropic.Usage? usage) + global::Anthropic.Usage usage, + global::Anthropic.MessageType type = global::Anthropic.MessageType.Message, + global::Anthropic.MessageRole role = global::Anthropic.MessageRole.Assistant) { - this.Content = content; - this.Role = role; - this.Id = id; + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Content = content ?? throw new global::System.ArgumentNullException(nameof(content)); this.Model = model; this.StopReason = stopReason; - this.StopSequence = stopSequence; + this.StopSequence = stopSequence ?? throw new global::System.ArgumentNullException(nameof(stopSequence)); + this.Usage = usage ?? throw new global::System.ArgumentNullException(nameof(usage)); this.Type = type; - this.Usage = usage; + this.Role = role; } /// diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatch.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatch.Json.g.cs deleted file mode 100644 index 4aa2bf6..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatch.Json.g.cs +++ /dev/null @@ -1,92 +0,0 @@ -#nullable enable - -namespace Anthropic -{ - public sealed partial class MessageBatch - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. - /// - public string ToJson( - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - this.GetType(), - jsonSerializerContext); - } - - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerContext. - /// - public static global::Anthropic.MessageBatch? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Anthropic.MessageBatch), - jsonSerializerContext) as global::Anthropic.MessageBatch; - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::Anthropic.MessageBatch? FromJson( - string json, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerContext. - /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Anthropic.MessageBatch), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.MessageBatch; - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); - } - } -} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatch.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatch.g.cs deleted file mode 100644 index d2ba371..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageBatch.g.cs +++ /dev/null @@ -1,116 +0,0 @@ - -#nullable enable - -namespace Anthropic -{ - /// - /// A batch of message requests. - /// - public sealed partial class MessageBatch - { - /// - /// Unique object identifier for the message batch. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("id")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Id { get; set; } - - /// - /// RFC 3339 datetime string representing the time at which the Message Batch was created. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::System.DateTime CreatedAt { get; set; } - - /// - /// RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("expires_at")] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::System.DateTime ExpiresAt { get; set; } - - /// - /// Processing status of the Message Batch. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("processing_status")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageBatchProcessingStatusJsonConverter))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageBatchProcessingStatus ProcessingStatus { get; set; } - - /// - /// Tallies requests within the Message Batch, categorized by their status. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("request_counts")] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageBatchRequestCounts RequestCounts { get; set; } - - /// - /// URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("results_url")] - public string? ResultsUrl { get; set; } - - /// - /// Object type. For Message Batches, this is always `"message_batch"`. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageBatchTypeJsonConverter))] - public global::Anthropic.MessageBatchType Type { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// Unique object identifier for the message batch. - /// - /// - /// RFC 3339 datetime string representing the time at which the Message Batch was created. - /// - /// - /// RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - /// - /// - /// Processing status of the Message Batch. - /// - /// - /// Tallies requests within the Message Batch, categorized by their status. - /// - /// - /// URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - /// - /// - /// Object type. For Message Batches, this is always `"message_batch"`. - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public MessageBatch( - string id, - global::System.DateTime createdAt, - global::System.DateTime expiresAt, - global::Anthropic.MessageBatchProcessingStatus processingStatus, - global::Anthropic.MessageBatchRequestCounts requestCounts, - string? resultsUrl, - global::Anthropic.MessageBatchType type) - { - this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); - this.CreatedAt = createdAt; - this.ExpiresAt = expiresAt; - this.ProcessingStatus = processingStatus; - this.RequestCounts = requestCounts ?? throw new global::System.ArgumentNullException(nameof(requestCounts)); - this.ResultsUrl = resultsUrl; - this.Type = type; - } - - /// - /// Initializes a new instance of the class. - /// - public MessageBatch() - { - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageDelta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDelta.g.cs index 77fa2b1..e1e590b 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageDelta.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDelta.g.cs @@ -4,31 +4,24 @@ namespace Anthropic { /// - /// A delta in a streaming message. + /// /// public sealed partial class MessageDelta { /// - /// The reason that we stopped.
- /// This may be one the following values:
- /// - `"end_turn"`: the model reached a natural stopping point
- /// - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
- /// - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
- /// - `"tool_use"`: the model invoked one or more tools
- /// In non-streaming mode this value is always non-null. In streaming mode, it is
- /// null in the `message_start` event and non-null otherwise. + /// ///
[global::System.Text.Json.Serialization.JsonPropertyName("stop_reason")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.StopReasonJsonConverter))] - public global::Anthropic.StopReason? StopReason { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageDeltaStopReasonJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.MessageDeltaStopReason? StopReason { get; set; } /// - /// Which custom stop sequence was generated, if any.
- /// This value will be a non-null string if one of your custom stop sequences was
- /// generated. + /// ///
[global::System.Text.Json.Serialization.JsonPropertyName("stop_sequence")] - public string? StopSequence { get; set; } + [global::System.Text.Json.Serialization.JsonRequired] + public required string? StopSequence { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -39,28 +32,15 @@ public sealed partial class MessageDelta /// /// Initializes a new instance of the class. /// - /// - /// The reason that we stopped.
- /// This may be one the following values:
- /// - `"end_turn"`: the model reached a natural stopping point
- /// - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
- /// - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
- /// - `"tool_use"`: the model invoked one or more tools
- /// In non-streaming mode this value is always non-null. In streaming mode, it is
- /// null in the `message_start` event and non-null otherwise. - /// - /// - /// Which custom stop sequence was generated, if any.
- /// This value will be a non-null string if one of your custom stop sequences was
- /// generated. - /// + /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MessageDelta( - global::Anthropic.StopReason? stopReason, + global::Anthropic.MessageDeltaStopReason? stopReason, string? stopSequence) { this.StopReason = stopReason; - this.StopSequence = stopSequence; + this.StopSequence = stopSequence ?? throw new global::System.ArgumentNullException(nameof(stopSequence)); } /// diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaEvent.g.cs index 3bbed8e..538c875 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaEvent.g.cs @@ -4,35 +4,30 @@ namespace Anthropic { /// - /// A delta event in a streaming conversation. + /// /// public sealed partial class MessageDeltaEvent { /// - /// A delta in a streaming message. + /// Default Value: message_delta /// - [global::System.Text.Json.Serialization.JsonPropertyName("delta")] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageDelta Delta { get; set; } + /// global::Anthropic.MessageDeltaEventType.MessageDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageDeltaEventTypeJsonConverter))] + public global::Anthropic.MessageDeltaEventType Type { get; set; } = global::Anthropic.MessageDeltaEventType.MessageDelta; /// - /// The type of a streaming event. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonPropertyName("delta")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + public required global::Anthropic.MessageDelta Delta { get; set; } /// /// Billing and rate-limit usage.
- /// Anthropic's API bills and rate-limits by token counts, as tokens represent the
- /// underlying cost to our systems.
- /// Under the hood, the API transforms requests into a format suitable for the
- /// model. The model's output then goes through a parsing stage before becoming an
- /// API response. As a result, the token counts in `usage` will not match one-to-one
- /// with the exact visible content of an API request or response.
- /// For example, `output_tokens` will be non-zero, even for an empty string response
- /// from Claude. + /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. ///
[global::System.Text.Json.Serialization.JsonPropertyName("usage")] [global::System.Text.Json.Serialization.JsonRequired] @@ -47,32 +42,25 @@ public sealed partial class MessageDeltaEvent /// /// Initializes a new instance of the class. /// - /// - /// A delta in a streaming message. - /// /// - /// The type of a streaming event. + /// Default Value: message_delta /// + /// /// /// Billing and rate-limit usage.
- /// Anthropic's API bills and rate-limits by token counts, as tokens represent the
- /// underlying cost to our systems.
- /// Under the hood, the API transforms requests into a format suitable for the
- /// model. The model's output then goes through a parsing stage before becoming an
- /// API response. As a result, the token counts in `usage` will not match one-to-one
- /// with the exact visible content of an API request or response.
- /// For example, `output_tokens` will be non-zero, even for an empty string response
- /// from Claude. + /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MessageDeltaEvent( global::Anthropic.MessageDelta delta, - global::Anthropic.MessageStreamEventType type, - global::Anthropic.MessageDeltaUsage usage) + global::Anthropic.MessageDeltaUsage usage, + global::Anthropic.MessageDeltaEventType type = global::Anthropic.MessageDeltaEventType.MessageDelta) { this.Delta = delta ?? throw new global::System.ArgumentNullException(nameof(delta)); - this.Type = type; this.Usage = usage ?? throw new global::System.ArgumentNullException(nameof(usage)); + this.Type = type; } /// diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaEventType.g.cs new file mode 100644 index 0000000..5dbdd46 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: message_delta + /// + public enum MessageDeltaEventType + { + /// + /// + /// + MessageDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class MessageDeltaEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this MessageDeltaEventType value) + { + return value switch + { + MessageDeltaEventType.MessageDelta => "message_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static MessageDeltaEventType? ToEnum(string value) + { + return value switch + { + "message_delta" => MessageDeltaEventType.MessageDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaStopReason.g.cs similarity index 53% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminatorType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaStopReason.g.cs index f33faee..e0714ef 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDiscriminatorType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaStopReason.g.cs @@ -6,56 +6,56 @@ namespace Anthropic /// /// /// - public enum BlockDiscriminatorType + public enum MessageDeltaStopReason { /// /// /// - Text, + EndTurn, /// /// /// - Image, + MaxTokens, /// /// /// - ToolUse, + StopSequence, /// /// /// - ToolResult, + ToolUse, } /// /// Enum extensions to do fast conversions without the reflection. /// - public static class BlockDiscriminatorTypeExtensions + public static class MessageDeltaStopReasonExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this BlockDiscriminatorType value) + public static string ToValueString(this MessageDeltaStopReason value) { return value switch { - BlockDiscriminatorType.Text => "text", - BlockDiscriminatorType.Image => "image", - BlockDiscriminatorType.ToolUse => "tool_use", - BlockDiscriminatorType.ToolResult => "tool_result", + MessageDeltaStopReason.EndTurn => "end_turn", + MessageDeltaStopReason.MaxTokens => "max_tokens", + MessageDeltaStopReason.StopSequence => "stop_sequence", + MessageDeltaStopReason.ToolUse => "tool_use", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static BlockDiscriminatorType? ToEnum(string value) + public static MessageDeltaStopReason? ToEnum(string value) { return value switch { - "text" => BlockDiscriminatorType.Text, - "image" => BlockDiscriminatorType.Image, - "tool_use" => BlockDiscriminatorType.ToolUse, - "tool_result" => BlockDiscriminatorType.ToolResult, + "end_turn" => MessageDeltaStopReason.EndTurn, + "max_tokens" => MessageDeltaStopReason.MaxTokens, + "stop_sequence" => MessageDeltaStopReason.StopSequence, + "tool_use" => MessageDeltaStopReason.ToolUse, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaUsage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaUsage.g.cs index 3e6204b..3930e3a 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaUsage.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageDeltaUsage.g.cs @@ -4,21 +4,15 @@ namespace Anthropic { /// - /// Billing and rate-limit usage.
- /// Anthropic's API bills and rate-limits by token counts, as tokens represent the
- /// underlying cost to our systems.
- /// Under the hood, the API transforms requests into a format suitable for the
- /// model. The model's output then goes through a parsing stage before becoming an
- /// API response. As a result, the token counts in `usage` will not match one-to-one
- /// with the exact visible content of an API request or response.
- /// For example, `output_tokens` will be non-zero, even for an empty string response
- /// from Claude. + /// ///
public sealed partial class MessageDeltaUsage { /// - /// The cumulative number of output tokens which were used. + /// The cumulative number of output tokens which were used.
+ /// Example: 503 ///
+ /// 503 [global::System.Text.Json.Serialization.JsonPropertyName("output_tokens")] [global::System.Text.Json.Serialization.JsonRequired] public required int OutputTokens { get; set; } @@ -33,7 +27,8 @@ public sealed partial class MessageDeltaUsage /// Initializes a new instance of the class. ///
/// - /// The cumulative number of output tokens which were used. + /// The cumulative number of output tokens which were used.
+ /// Example: 503 /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MessageDeltaUsage( diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageRole.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageRole.g.cs index f0fea32..dc0034f 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageRole.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageRole.g.cs @@ -4,14 +4,12 @@ namespace Anthropic { /// - /// The role of the messages author. + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant ///
public enum MessageRole { - /// - /// - /// - User, /// /// /// @@ -30,7 +28,6 @@ public static string ToValueString(this MessageRole value) { return value switch { - MessageRole.User => "user", MessageRole.Assistant => "assistant", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; @@ -42,7 +39,6 @@ public static string ToValueString(this MessageRole value) { return value switch { - "user" => MessageRole.User, "assistant" => MessageRole.Assistant, _ => null, }; diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStartEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStartEvent.g.cs index d1bc08b..a90d241 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStartEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStartEvent.g.cs @@ -4,24 +4,24 @@ namespace Anthropic { /// - /// A start event in a streaming conversation. + /// /// public sealed partial class MessageStartEvent { /// - /// A message in a chat conversation. + /// Default Value: message_start /// - [global::System.Text.Json.Serialization.JsonPropertyName("message")] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.Message Message { get; set; } + /// global::Anthropic.MessageStartEventType.MessageStart + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStartEventTypeJsonConverter))] + public global::Anthropic.MessageStartEventType Type { get; set; } = global::Anthropic.MessageStartEventType.MessageStart; /// - /// The type of a streaming event. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonPropertyName("message")] [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + public required global::Anthropic.Message Message { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -32,16 +32,14 @@ public sealed partial class MessageStartEvent /// /// Initializes a new instance of the class. /// - /// - /// A message in a chat conversation. - /// /// - /// The type of a streaming event. + /// Default Value: message_start /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MessageStartEvent( global::Anthropic.Message message, - global::Anthropic.MessageStreamEventType type) + global::Anthropic.MessageStartEventType type = global::Anthropic.MessageStartEventType.MessageStart) { this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); this.Type = type; diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStartEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStartEventType.g.cs new file mode 100644 index 0000000..21d58eb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStartEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: message_start + /// + public enum MessageStartEventType + { + /// + /// + /// + MessageStart, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class MessageStartEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this MessageStartEventType value) + { + return value switch + { + MessageStartEventType.MessageStart => "message_start", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static MessageStartEventType? ToEnum(string value) + { + return value switch + { + "message_start" => MessageStartEventType.MessageStart, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopEvent.g.cs index ebae724..0eae069 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopEvent.g.cs @@ -4,17 +4,17 @@ namespace Anthropic { /// - /// A stop event in a streaming conversation. + /// /// public sealed partial class MessageStopEvent { /// - /// The type of a streaming event. + /// Default Value: message_stop /// + /// global::Anthropic.MessageStopEventType.MessageStop [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStopEventTypeJsonConverter))] + public global::Anthropic.MessageStopEventType Type { get; set; } = global::Anthropic.MessageStopEventType.MessageStop; /// /// Additional properties that are not explicitly defined in the schema @@ -26,11 +26,11 @@ public sealed partial class MessageStopEvent /// Initializes a new instance of the class. /// /// - /// The type of a streaming event. + /// Default Value: message_stop /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MessageStopEvent( - global::Anthropic.MessageStreamEventType type) + global::Anthropic.MessageStopEventType type = global::Anthropic.MessageStopEventType.MessageStop) { this.Type = type; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopEventType.g.cs new file mode 100644 index 0000000..9e61a3e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: message_stop + /// + public enum MessageStopEventType + { + /// + /// + /// + MessageStop, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class MessageStopEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this MessageStopEventType value) + { + return value switch + { + MessageStopEventType.MessageStop => "message_stop", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static MessageStopEventType? ToEnum(string value) + { + return value switch + { + "message_stop" => MessageStopEventType.MessageStop, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.StopReason.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopReason.g.cs similarity index 57% rename from src/libs/Anthropic/Generated/Anthropic.Models.StopReason.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.MessageStopReason.g.cs index 97572a9..f553482 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.StopReason.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStopReason.g.cs @@ -6,14 +6,13 @@ namespace Anthropic /// /// The reason that we stopped.
/// This may be one the following values:
- /// - `"end_turn"`: the model reached a natural stopping point
- /// - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
- /// - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
- /// - `"tool_use"`: the model invoked one or more tools
- /// In non-streaming mode this value is always non-null. In streaming mode, it is
- /// null in the `message_start` event and non-null otherwise. + /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. ///
- public enum StopReason + public enum MessageStopReason { /// /// the model reached a natural stopping point @@ -36,33 +35,33 @@ public enum StopReason /// /// Enum extensions to do fast conversions without the reflection. /// - public static class StopReasonExtensions + public static class MessageStopReasonExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this StopReason value) + public static string ToValueString(this MessageStopReason value) { return value switch { - StopReason.EndTurn => "end_turn", - StopReason.MaxTokens => "max_tokens", - StopReason.StopSequence => "stop_sequence", - StopReason.ToolUse => "tool_use", + MessageStopReason.EndTurn => "end_turn", + MessageStopReason.MaxTokens => "max_tokens", + MessageStopReason.StopSequence => "stop_sequence", + MessageStopReason.ToolUse => "tool_use", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static StopReason? ToEnum(string value) + public static MessageStopReason? ToEnum(string value) { return value switch { - "end_turn" => StopReason.EndTurn, - "max_tokens" => StopReason.MaxTokens, - "stop_sequence" => StopReason.StopSequence, - "tool_use" => StopReason.ToolUse, + "end_turn" => MessageStopReason.EndTurn, + "max_tokens" => MessageStopReason.MaxTokens, + "stop_sequence" => MessageStopReason.StopSequence, + "tool_use" => MessageStopReason.ToolUse, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEvent.g.cs index 2706e86..7aef540 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEvent.g.cs @@ -5,31 +5,26 @@ namespace Anthropic { /// - /// A event in a streaming conversation. + /// /// public readonly partial struct MessageStreamEvent : global::System.IEquatable { /// /// /// - public global::Anthropic.MessageStreamEventDiscriminatorType? Type { get; } - - /// - /// A start event in a streaming conversation. - /// #if NET6_0_OR_GREATER - public global::Anthropic.MessageStartEvent? MessageStart { get; init; } + public global::Anthropic.MessageStartEvent? Start { get; init; } #else - public global::Anthropic.MessageStartEvent? MessageStart { get; } + public global::Anthropic.MessageStartEvent? Start { get; } #endif /// /// /// #if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageStart))] + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Start))] #endif - public bool IsMessageStart => MessageStart != null; + public bool IsStart => Start != null; /// /// @@ -39,32 +34,32 @@ namespace Anthropic /// /// /// - public static implicit operator global::Anthropic.MessageStartEvent?(MessageStreamEvent @this) => @this.MessageStart; + public static implicit operator global::Anthropic.MessageStartEvent?(MessageStreamEvent @this) => @this.Start; /// /// /// public MessageStreamEvent(global::Anthropic.MessageStartEvent? value) { - MessageStart = value; + Start = value; } /// - /// A delta event in a streaming conversation. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.MessageDeltaEvent? MessageDelta { get; init; } + public global::Anthropic.MessageDeltaEvent? Delta { get; init; } #else - public global::Anthropic.MessageDeltaEvent? MessageDelta { get; } + public global::Anthropic.MessageDeltaEvent? Delta { get; } #endif /// /// /// #if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageDelta))] + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Delta))] #endif - public bool IsMessageDelta => MessageDelta != null; + public bool IsDelta => Delta != null; /// /// @@ -74,32 +69,32 @@ public MessageStreamEvent(global::Anthropic.MessageStartEvent? value) /// /// /// - public static implicit operator global::Anthropic.MessageDeltaEvent?(MessageStreamEvent @this) => @this.MessageDelta; + public static implicit operator global::Anthropic.MessageDeltaEvent?(MessageStreamEvent @this) => @this.Delta; /// /// /// public MessageStreamEvent(global::Anthropic.MessageDeltaEvent? value) { - MessageDelta = value; + Delta = value; } /// - /// A stop event in a streaming conversation. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.MessageStopEvent? MessageStop { get; init; } + public global::Anthropic.MessageStopEvent? Stop { get; init; } #else - public global::Anthropic.MessageStopEvent? MessageStop { get; } + public global::Anthropic.MessageStopEvent? Stop { get; } #endif /// /// /// #if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageStop))] + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Stop))] #endif - public bool IsMessageStop => MessageStop != null; + public bool IsStop => Stop != null; /// /// @@ -109,18 +104,18 @@ public MessageStreamEvent(global::Anthropic.MessageDeltaEvent? value) /// /// /// - public static implicit operator global::Anthropic.MessageStopEvent?(MessageStreamEvent @this) => @this.MessageStop; + public static implicit operator global::Anthropic.MessageStopEvent?(MessageStreamEvent @this) => @this.Stop; /// /// /// public MessageStreamEvent(global::Anthropic.MessageStopEvent? value) { - MessageStop = value; + Stop = value; } /// - /// A start event in a streaming content block. + /// /// #if NET6_0_OR_GREATER public global::Anthropic.ContentBlockStartEvent? ContentBlockStart { get; init; } @@ -155,7 +150,7 @@ public MessageStreamEvent(global::Anthropic.ContentBlockStartEvent? value) } /// - /// A delta event in a streaming content block. + /// /// #if NET6_0_OR_GREATER public global::Anthropic.ContentBlockDeltaEvent? ContentBlockDelta { get; init; } @@ -190,7 +185,7 @@ public MessageStreamEvent(global::Anthropic.ContentBlockDeltaEvent? value) } /// - /// A stop event in a streaming content block. + /// /// #if NET6_0_OR_GREATER public global::Anthropic.ContentBlockStopEvent? ContentBlockStop { get; init; } @@ -225,12 +220,12 @@ public MessageStreamEvent(global::Anthropic.ContentBlockStopEvent? value) } /// - /// A ping event in a streaming conversation. + /// /// #if NET6_0_OR_GREATER - public global::Anthropic.PingEvent? Ping { get; init; } + public global::Anthropic.Ping? Ping { get; init; } #else - public global::Anthropic.PingEvent? Ping { get; } + public global::Anthropic.Ping? Ping { get; } #endif /// @@ -244,95 +239,54 @@ public MessageStreamEvent(global::Anthropic.ContentBlockStopEvent? value) /// /// /// - public static implicit operator MessageStreamEvent(global::Anthropic.PingEvent value) => new MessageStreamEvent(value); + public static implicit operator MessageStreamEvent(global::Anthropic.Ping value) => new MessageStreamEvent(value); /// /// /// - public static implicit operator global::Anthropic.PingEvent?(MessageStreamEvent @this) => @this.Ping; + public static implicit operator global::Anthropic.Ping?(MessageStreamEvent @this) => @this.Ping; /// /// /// - public MessageStreamEvent(global::Anthropic.PingEvent? value) + public MessageStreamEvent(global::Anthropic.Ping? value) { Ping = value; } - /// - /// An error event in a streaming conversation. - /// -#if NET6_0_OR_GREATER - public global::Anthropic.ErrorEvent? Error { get; init; } -#else - public global::Anthropic.ErrorEvent? Error { get; } -#endif - - /// - /// - /// -#if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Error))] -#endif - public bool IsError => Error != null; - - /// - /// - /// - public static implicit operator MessageStreamEvent(global::Anthropic.ErrorEvent value) => new MessageStreamEvent(value); - - /// - /// - /// - public static implicit operator global::Anthropic.ErrorEvent?(MessageStreamEvent @this) => @this.Error; - - /// - /// - /// - public MessageStreamEvent(global::Anthropic.ErrorEvent? value) - { - Error = value; - } - /// /// /// public MessageStreamEvent( - global::Anthropic.MessageStreamEventDiscriminatorType? type, - global::Anthropic.MessageStartEvent? messageStart, - global::Anthropic.MessageDeltaEvent? messageDelta, - global::Anthropic.MessageStopEvent? messageStop, + global::Anthropic.MessageStartEvent? start, + global::Anthropic.MessageDeltaEvent? delta, + global::Anthropic.MessageStopEvent? stop, global::Anthropic.ContentBlockStartEvent? contentBlockStart, global::Anthropic.ContentBlockDeltaEvent? contentBlockDelta, global::Anthropic.ContentBlockStopEvent? contentBlockStop, - global::Anthropic.PingEvent? ping, - global::Anthropic.ErrorEvent? error + global::Anthropic.Ping? ping ) { - Type = type; - - MessageStart = messageStart; - MessageDelta = messageDelta; - MessageStop = messageStop; + Start = start; + Delta = delta; + Stop = stop; ContentBlockStart = contentBlockStart; ContentBlockDelta = contentBlockDelta; ContentBlockStop = contentBlockStop; Ping = ping; - Error = error; } /// /// /// public object? Object => - Error as object ?? Ping as object ?? ContentBlockStop as object ?? ContentBlockDelta as object ?? ContentBlockStart as object ?? - MessageStop as object ?? - MessageDelta as object ?? - MessageStart as object + Stop as object ?? + Delta as object ?? + Start as object ; /// @@ -340,21 +294,20 @@ MessageStart as object /// public bool Validate() { - return IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing && !IsError || !IsMessageStart && IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing && !IsError || !IsMessageStart && !IsMessageDelta && IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing && !IsError || !IsMessageStart && !IsMessageDelta && !IsMessageStop && IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing && !IsError || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && IsContentBlockDelta && !IsContentBlockStop && !IsPing && !IsError || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && IsContentBlockStop && !IsPing && !IsError || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && IsPing && !IsError || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing && IsError; + return IsStart && !IsDelta && !IsStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing || !IsStart && IsDelta && !IsStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing || !IsStart && !IsDelta && IsStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing || !IsStart && !IsDelta && !IsStop && IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && !IsPing || !IsStart && !IsDelta && !IsStop && !IsContentBlockStart && IsContentBlockDelta && !IsContentBlockStop && !IsPing || !IsStart && !IsDelta && !IsStop && !IsContentBlockStart && !IsContentBlockDelta && IsContentBlockStop && !IsPing || !IsStart && !IsDelta && !IsStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop && IsPing; } /// /// /// public TResult? Match( - global::System.Func? messageStart = null, - global::System.Func? messageDelta = null, - global::System.Func? messageStop = null, + global::System.Func? start = null, + global::System.Func? delta = null, + global::System.Func? stop = null, global::System.Func? contentBlockStart = null, global::System.Func? contentBlockDelta = null, global::System.Func? contentBlockStop = null, - global::System.Func? ping = null, - global::System.Func? error = null, + global::System.Func? ping = null, bool validate = true) { if (validate) @@ -362,17 +315,17 @@ public bool Validate() Validate(); } - if (IsMessageStart && messageStart != null) + if (IsStart && start != null) { - return messageStart(MessageStart!); + return start(Start!); } - else if (IsMessageDelta && messageDelta != null) + else if (IsDelta && delta != null) { - return messageDelta(MessageDelta!); + return delta(Delta!); } - else if (IsMessageStop && messageStop != null) + else if (IsStop && stop != null) { - return messageStop(MessageStop!); + return stop(Stop!); } else if (IsContentBlockStart && contentBlockStart != null) { @@ -390,10 +343,6 @@ public bool Validate() { return ping(Ping!); } - else if (IsError && error != null) - { - return error(Error!); - } return default(TResult); } @@ -402,14 +351,13 @@ public bool Validate() /// /// public void Match( - global::System.Action? messageStart = null, - global::System.Action? messageDelta = null, - global::System.Action? messageStop = null, + global::System.Action? start = null, + global::System.Action? delta = null, + global::System.Action? stop = null, global::System.Action? contentBlockStart = null, global::System.Action? contentBlockDelta = null, global::System.Action? contentBlockStop = null, - global::System.Action? ping = null, - global::System.Action? error = null, + global::System.Action? ping = null, bool validate = true) { if (validate) @@ -417,17 +365,17 @@ public void Match( Validate(); } - if (IsMessageStart) + if (IsStart) { - messageStart?.Invoke(MessageStart!); + start?.Invoke(Start!); } - else if (IsMessageDelta) + else if (IsDelta) { - messageDelta?.Invoke(MessageDelta!); + delta?.Invoke(Delta!); } - else if (IsMessageStop) + else if (IsStop) { - messageStop?.Invoke(MessageStop!); + stop?.Invoke(Stop!); } else if (IsContentBlockStart) { @@ -445,10 +393,6 @@ public void Match( { ping?.Invoke(Ping!); } - else if (IsError) - { - error?.Invoke(Error!); - } } /// @@ -458,11 +402,11 @@ public override int GetHashCode() { var fields = new object?[] { - MessageStart, + Start, typeof(global::Anthropic.MessageStartEvent), - MessageDelta, + Delta, typeof(global::Anthropic.MessageDeltaEvent), - MessageStop, + Stop, typeof(global::Anthropic.MessageStopEvent), ContentBlockStart, typeof(global::Anthropic.ContentBlockStartEvent), @@ -471,9 +415,7 @@ public override int GetHashCode() ContentBlockStop, typeof(global::Anthropic.ContentBlockStopEvent), Ping, - typeof(global::Anthropic.PingEvent), - Error, - typeof(global::Anthropic.ErrorEvent), + typeof(global::Anthropic.Ping), }; const int offset = unchecked((int)2166136261); const int prime = 16777619; @@ -490,14 +432,13 @@ static int HashCodeAggregator(int hashCode, object? value) => value == null public bool Equals(MessageStreamEvent other) { return - global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageStart, other.MessageStart) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageDelta, other.MessageDelta) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageStop, other.MessageStop) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Start, other.Start) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Delta, other.Delta) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Stop, other.Stop) && global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockStart, other.ContentBlockStart) && global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockDelta, other.ContentBlockDelta) && global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockStop, other.ContentBlockStop) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(Ping, other.Ping) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(Error, other.Error) + global::System.Collections.Generic.EqualityComparer.Default.Equals(Ping, other.Ping) ; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEventDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEventDiscriminatorType.g.cs index b791d0b..28f5d8a 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEventDiscriminatorType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEventDiscriminatorType.g.cs @@ -11,15 +11,7 @@ public enum MessageStreamEventDiscriminatorType /// /// /// - MessageStart, - /// - /// - /// - MessageDelta, - /// - /// - /// - MessageStop, + ContentBlockDelta, /// /// /// @@ -27,19 +19,19 @@ public enum MessageStreamEventDiscriminatorType /// /// /// - ContentBlockDelta, + ContentBlockStop, /// /// /// - ContentBlockStop, + MessageDelta, /// /// /// - Ping, + MessageStart, /// /// /// - Error, + MessageStop, } /// @@ -54,14 +46,12 @@ public static string ToValueString(this MessageStreamEventDiscriminatorType valu { return value switch { - MessageStreamEventDiscriminatorType.MessageStart => "message_start", - MessageStreamEventDiscriminatorType.MessageDelta => "message_delta", - MessageStreamEventDiscriminatorType.MessageStop => "message_stop", - MessageStreamEventDiscriminatorType.ContentBlockStart => "content_block_start", MessageStreamEventDiscriminatorType.ContentBlockDelta => "content_block_delta", + MessageStreamEventDiscriminatorType.ContentBlockStart => "content_block_start", MessageStreamEventDiscriminatorType.ContentBlockStop => "content_block_stop", - MessageStreamEventDiscriminatorType.Ping => "ping", - MessageStreamEventDiscriminatorType.Error => "error", + MessageStreamEventDiscriminatorType.MessageDelta => "message_delta", + MessageStreamEventDiscriminatorType.MessageStart => "message_start", + MessageStreamEventDiscriminatorType.MessageStop => "message_stop", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -72,14 +62,12 @@ public static string ToValueString(this MessageStreamEventDiscriminatorType valu { return value switch { - "message_start" => MessageStreamEventDiscriminatorType.MessageStart, - "message_delta" => MessageStreamEventDiscriminatorType.MessageDelta, - "message_stop" => MessageStreamEventDiscriminatorType.MessageStop, - "content_block_start" => MessageStreamEventDiscriminatorType.ContentBlockStart, "content_block_delta" => MessageStreamEventDiscriminatorType.ContentBlockDelta, + "content_block_start" => MessageStreamEventDiscriminatorType.ContentBlockStart, "content_block_stop" => MessageStreamEventDiscriminatorType.ContentBlockStop, - "ping" => MessageStreamEventDiscriminatorType.Ping, - "error" => MessageStreamEventDiscriminatorType.Error, + "message_delta" => MessageStreamEventDiscriminatorType.MessageDelta, + "message_start" => MessageStreamEventDiscriminatorType.MessageStart, + "message_stop" => MessageStreamEventDiscriminatorType.MessageStop, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEventType.g.cs deleted file mode 100644 index 99799fe..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.MessageStreamEventType.g.cs +++ /dev/null @@ -1,87 +0,0 @@ - -#nullable enable - -namespace Anthropic -{ - /// - /// The type of a streaming event. - /// - public enum MessageStreamEventType - { - /// - /// - /// - MessageStart, - /// - /// - /// - MessageDelta, - /// - /// - /// - MessageStop, - /// - /// - /// - ContentBlockStart, - /// - /// - /// - ContentBlockDelta, - /// - /// - /// - ContentBlockStop, - /// - /// - /// - Ping, - /// - /// - /// - Error, - } - - /// - /// Enum extensions to do fast conversions without the reflection. - /// - public static class MessageStreamEventTypeExtensions - { - /// - /// Converts an enum to a string. - /// - public static string ToValueString(this MessageStreamEventType value) - { - return value switch - { - MessageStreamEventType.MessageStart => "message_start", - MessageStreamEventType.MessageDelta => "message_delta", - MessageStreamEventType.MessageStop => "message_stop", - MessageStreamEventType.ContentBlockStart => "content_block_start", - MessageStreamEventType.ContentBlockDelta => "content_block_delta", - MessageStreamEventType.ContentBlockStop => "content_block_stop", - MessageStreamEventType.Ping => "ping", - MessageStreamEventType.Error => "error", - _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), - }; - } - /// - /// Converts an string to a enum. - /// - public static MessageStreamEventType? ToEnum(string value) - { - return value switch - { - "message_start" => MessageStreamEventType.MessageStart, - "message_delta" => MessageStreamEventType.MessageDelta, - "message_stop" => MessageStreamEventType.MessageStop, - "content_block_start" => MessageStreamEventType.ContentBlockStart, - "content_block_delta" => MessageStreamEventType.ContentBlockDelta, - "content_block_stop" => MessageStreamEventType.ContentBlockStop, - "ping" => MessageStreamEventType.Ping, - "error" => MessageStreamEventType.Error, - _ => null, - }; - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.MessageType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.MessageType.g.cs new file mode 100644 index 0000000..bfa4c2c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.MessageType.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message + ///
+ public enum MessageType + { + /// + /// + /// + Message, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class MessageTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this MessageType value) + { + return value switch + { + MessageType.Message => "message", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static MessageType? ToEnum(string value) + { + return value switch + { + "message" => MessageType.Message, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Metadata.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Metadata.Json.g.cs new file mode 100644 index 0000000..373a8ae --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Metadata.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class Metadata + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.Metadata? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.Metadata), + jsonSerializerContext) as global::Anthropic.Metadata; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.Metadata? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.Metadata), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Metadata; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Metadata.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Metadata.g.cs new file mode 100644 index 0000000..3ee123f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Metadata.g.cs @@ -0,0 +1,48 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class Metadata + { + /// + /// An external identifier for the user who is associated with the request.
+ /// This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
+ /// Example: 13803d75-b4b5-4c3e-b2a2-6f21399b021b + ///
+ /// 13803d75-b4b5-4c3e-b2a2-6f21399b021b + [global::System.Text.Json.Serialization.JsonPropertyName("user_id")] + public string? UserId { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// An external identifier for the user who is associated with the request.
+ /// This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
+ /// Example: 13803d75-b4b5-4c3e-b2a2-6f21399b021b + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Metadata( + string? userId) + { + this.UserId = userId; + } + + /// + /// Initializes a new instance of the class. + /// + public Metadata() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Model.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Model.Json.g.cs new file mode 100644 index 0000000..d08448b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Model.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct Model + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.Model? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.Model), + jsonSerializerContext) as global::Anthropic.Model?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.Model? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.Model), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Model?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/OneOf.2.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Model.g.cs similarity index 67% rename from src/libs/Anthropic/Generated/OneOf.2.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Model.g.cs index 99e7f20..9b73ad0 100644 --- a/src/libs/Anthropic/Generated/OneOf.2.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Model.g.cs @@ -1,20 +1,21 @@ +#pragma warning disable CS0618 // Type or member is obsolete #nullable enable namespace Anthropic { /// - /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. /// - public readonly partial struct OneOf : global::System.IEquatable> + public readonly partial struct Model : global::System.IEquatable { /// /// /// #if NET6_0_OR_GREATER - public T1? Value1 { get; init; } + public string? Value1 { get; init; } #else - public T1? Value1 { get; } + public string? Value1 { get; } #endif /// @@ -28,17 +29,17 @@ namespace Anthropic /// /// /// - public static implicit operator OneOf(T1 value) => new OneOf(value); + public static implicit operator Model(string value) => new Model(value); /// /// /// - public static implicit operator T1?(OneOf @this) => @this.Value1; + public static implicit operator string?(Model @this) => @this.Value1; /// /// /// - public OneOf(T1? value) + public Model(string? value) { Value1 = value; } @@ -47,9 +48,9 @@ public OneOf(T1? value) /// /// #if NET6_0_OR_GREATER - public T2? Value2 { get; init; } + public global::Anthropic.ModelEnum? Value2 { get; init; } #else - public T2? Value2 { get; } + public global::Anthropic.ModelEnum? Value2 { get; } #endif /// @@ -63,17 +64,17 @@ public OneOf(T1? value) /// /// /// - public static implicit operator OneOf(T2 value) => new OneOf(value); + public static implicit operator Model(global::Anthropic.ModelEnum value) => new Model(value); /// /// /// - public static implicit operator T2?(OneOf @this) => @this.Value2; + public static implicit operator global::Anthropic.ModelEnum?(Model @this) => @this.Value2; /// /// /// - public OneOf(T2? value) + public Model(global::Anthropic.ModelEnum? value) { Value2 = value; } @@ -81,9 +82,9 @@ public OneOf(T2? value) /// /// /// - public OneOf( - T1? value1, - T2? value2 + public Model( + string? value1, + global::Anthropic.ModelEnum? value2 ) { Value1 = value1; @@ -103,15 +104,15 @@ Value1 as object /// public bool Validate() { - return IsValue1 && !IsValue2 || !IsValue1 && IsValue2; + return IsValue1 || IsValue2; } /// /// /// public TResult? Match( - global::System.Func? value1 = null, - global::System.Func? value2 = null, + global::System.Func? value1 = null, + global::System.Func? value2 = null, bool validate = true) { if (validate) @@ -135,8 +136,8 @@ public bool Validate() /// ///
public void Match( - global::System.Action? value1 = null, - global::System.Action? value2 = null, + global::System.Action? value1 = null, + global::System.Action? value2 = null, bool validate = true) { if (validate) @@ -162,9 +163,9 @@ public override int GetHashCode() var fields = new object?[] { Value1, - typeof(T1), + typeof(string), Value2, - typeof(T2), + typeof(global::Anthropic.ModelEnum), }; const int offset = unchecked((int)2166136261); const int prime = 16777619; @@ -178,26 +179,26 @@ static int HashCodeAggregator(int hashCode, object? value) => value == null /// /// /// - public bool Equals(OneOf other) + public bool Equals(Model other) { return - global::System.Collections.Generic.EqualityComparer.Default.Equals(Value1, other.Value1) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(Value2, other.Value2) + global::System.Collections.Generic.EqualityComparer.Default.Equals(Value1, other.Value1) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Value2, other.Value2) ; } /// /// /// - public static bool operator ==(OneOf obj1, OneOf obj2) + public static bool operator ==(Model obj1, Model obj2) { - return global::System.Collections.Generic.EqualityComparer>.Default.Equals(obj1, obj2); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); } /// /// /// - public static bool operator !=(OneOf obj1, OneOf obj2) + public static bool operator !=(Model obj1, Model obj2) { return !(obj1 == obj2); } @@ -207,7 +208,7 @@ public bool Equals(OneOf other) ///
public override bool Equals(object? obj) { - return obj is OneOf o && Equals(o); + return obj is Model o && Equals(o); } } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ModelEnum.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ModelEnum.g.cs new file mode 100644 index 0000000..a751d82 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ModelEnum.g.cs @@ -0,0 +1,111 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ModelEnum + { + /// + /// Fast and cost-effective model + /// + Claude35HaikuLatest, + /// + /// Fast and cost-effective model + /// + Claude3Haiku20241022, + /// + /// Our most intelligent model + /// + Claude35SonnetLatest, + /// + /// Our most intelligent model + /// + Claude35Sonnet20241022, + /// + /// Our previous most intelligent model + /// + Claude35Sonnet20240620, + /// + /// Excels at writing and complex tasks + /// + Claude3OpusLatest, + /// + /// Excels at writing and complex tasks + /// + Claude3Opus20240229, + /// + /// Balance of speed and intelligence + /// + Claude3Sonnet20240229, + /// + /// Our previous fast and cost-effective + /// + Claude3Haiku20240307, + /// + /// + /// + Claude21, + /// + /// + /// + Claude20, + /// + /// + /// + ClaudeInstant12, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ModelEnumExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ModelEnum value) + { + return value switch + { + ModelEnum.Claude35HaikuLatest => "claude-3-5-haiku-latest", + ModelEnum.Claude3Haiku20241022 => "claude-3-haiku-20241022", + ModelEnum.Claude35SonnetLatest => "claude-3-5-sonnet-latest", + ModelEnum.Claude35Sonnet20241022 => "claude-3-5-sonnet-20241022", + ModelEnum.Claude35Sonnet20240620 => "claude-3-5-sonnet-20240620", + ModelEnum.Claude3OpusLatest => "claude-3-opus-latest", + ModelEnum.Claude3Opus20240229 => "claude-3-opus-20240229", + ModelEnum.Claude3Sonnet20240229 => "claude-3-sonnet-20240229", + ModelEnum.Claude3Haiku20240307 => "claude-3-haiku-20240307", + ModelEnum.Claude21 => "claude-2.1", + ModelEnum.Claude20 => "claude-2.0", + ModelEnum.ClaudeInstant12 => "claude-instant-1.2", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ModelEnum? ToEnum(string value) + { + return value switch + { + "claude-3-5-haiku-latest" => ModelEnum.Claude35HaikuLatest, + "claude-3-haiku-20241022" => ModelEnum.Claude3Haiku20241022, + "claude-3-5-sonnet-latest" => ModelEnum.Claude35SonnetLatest, + "claude-3-5-sonnet-20241022" => ModelEnum.Claude35Sonnet20241022, + "claude-3-5-sonnet-20240620" => ModelEnum.Claude35Sonnet20240620, + "claude-3-opus-latest" => ModelEnum.Claude3OpusLatest, + "claude-3-opus-20240229" => ModelEnum.Claude3Opus20240229, + "claude-3-sonnet-20240229" => ModelEnum.Claude3Sonnet20240229, + "claude-3-haiku-20240307" => ModelEnum.Claude3Haiku20240307, + "claude-2.1" => ModelEnum.Claude21, + "claude-2.0" => ModelEnum.Claude20, + "claude-instant-1.2" => ModelEnum.ClaudeInstant12, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundError.Json.g.cs new file mode 100644 index 0000000..841733a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class NotFoundError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.NotFoundError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.NotFoundError), + jsonSerializerContext) as global::Anthropic.NotFoundError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.NotFoundError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.NotFoundError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.NotFoundError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundError.g.cs new file mode 100644 index 0000000..0160ded --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class NotFoundError + { + /// + /// Default Value: not_found_error + /// + /// global::Anthropic.NotFoundErrorType.NotFoundError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.NotFoundErrorTypeJsonConverter))] + public global::Anthropic.NotFoundErrorType Type { get; set; } = global::Anthropic.NotFoundErrorType.NotFoundError; + + /// + /// Default Value: Not found + /// + /// "Not found" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Not found"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: not_found_error + /// + /// + /// Default Value: Not found + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NotFoundError( + string message, + global::Anthropic.NotFoundErrorType type = global::Anthropic.NotFoundErrorType.NotFoundError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public NotFoundError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundErrorType.g.cs new file mode 100644 index 0000000..46fe867 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.NotFoundErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: not_found_error + /// + public enum NotFoundErrorType + { + /// + /// + /// + NotFoundError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class NotFoundErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this NotFoundErrorType value) + { + return value switch + { + NotFoundErrorType.NotFoundError => "not_found_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static NotFoundErrorType? ToEnum(string value) + { + return value switch + { + "not_found_error" => NotFoundErrorType.NotFoundError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedError.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlock.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.OverloadedError.Json.g.cs index 851a6a0..6d59953 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlock.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedError.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolResultBlock + public sealed partial class OverloadedError { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolResultBlock? FromJson( + public static global::Anthropic.OverloadedError? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolResultBlock), - jsonSerializerContext) as global::Anthropic.ToolResultBlock; + typeof(global::Anthropic.OverloadedError), + jsonSerializerContext) as global::Anthropic.OverloadedError; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolResultBlock? FromJson( + public static global::Anthropic.OverloadedError? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolResultBlock), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolResultBlock; + typeof(global::Anthropic.OverloadedError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.OverloadedError; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedError.g.cs new file mode 100644 index 0000000..69d254b --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class OverloadedError + { + /// + /// Default Value: overloaded_error + /// + /// global::Anthropic.OverloadedErrorType.OverloadedError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.OverloadedErrorTypeJsonConverter))] + public global::Anthropic.OverloadedErrorType Type { get; set; } = global::Anthropic.OverloadedErrorType.OverloadedError; + + /// + /// Default Value: Overloaded + /// + /// "Overloaded" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Overloaded"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: overloaded_error + /// + /// + /// Default Value: Overloaded + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OverloadedError( + string message, + global::Anthropic.OverloadedErrorType type = global::Anthropic.OverloadedErrorType.OverloadedError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public OverloadedError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedErrorType.g.cs new file mode 100644 index 0000000..fc55388 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.OverloadedErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: overloaded_error + /// + public enum OverloadedErrorType + { + /// + /// + /// + OverloadedError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class OverloadedErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this OverloadedErrorType value) + { + return value switch + { + OverloadedErrorType.OverloadedError => "overloaded_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static OverloadedErrorType? ToEnum(string value) + { + return value switch + { + "overloaded_error" => OverloadedErrorType.OverloadedError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PermissionError.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PermissionError.Json.g.cs new file mode 100644 index 0000000..4870897 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PermissionError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PermissionError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PermissionError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PermissionError), + jsonSerializerContext) as global::Anthropic.PermissionError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PermissionError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PermissionError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PermissionError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PermissionError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PermissionError.g.cs new file mode 100644 index 0000000..59c633a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PermissionError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PermissionError + { + /// + /// Default Value: permission_error + /// + /// global::Anthropic.PermissionErrorType.PermissionError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PermissionErrorTypeJsonConverter))] + public global::Anthropic.PermissionErrorType Type { get; set; } = global::Anthropic.PermissionErrorType.PermissionError; + + /// + /// Default Value: Permission denied + /// + /// "Permission denied" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Permission denied"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: permission_error + /// + /// + /// Default Value: Permission denied + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PermissionError( + string message, + global::Anthropic.PermissionErrorType type = global::Anthropic.PermissionErrorType.PermissionError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PermissionError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PermissionErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PermissionErrorType.g.cs new file mode 100644 index 0000000..349bc7c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PermissionErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: permission_error + /// + public enum PermissionErrorType + { + /// + /// + /// + PermissionError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PermissionErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PermissionErrorType value) + { + return value switch + { + PermissionErrorType.PermissionError => "permission_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PermissionErrorType? ToEnum(string value) + { + return value switch + { + "permission_error" => PermissionErrorType.PermissionError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PingEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Ping.Json.g.cs similarity index 90% rename from src/libs/Anthropic/Generated/Anthropic.Models.PingEvent.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Ping.Json.g.cs index 735d0e2..7685cf0 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.PingEvent.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Ping.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class PingEvent + public sealed partial class Ping { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.PingEvent? FromJson( + public static global::Anthropic.Ping? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.PingEvent), - jsonSerializerContext) as global::Anthropic.PingEvent; + typeof(global::Anthropic.Ping), + jsonSerializerContext) as global::Anthropic.Ping; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.PingEvent? FromJson( + public static global::Anthropic.Ping? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.PingEvent), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PingEvent; + typeof(global::Anthropic.Ping), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Ping; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PingEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Ping.g.cs similarity index 58% rename from src/libs/Anthropic/Generated/Anthropic.Models.PingEvent.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.Ping.g.cs index d346de9..ac80faa 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.PingEvent.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Ping.g.cs @@ -4,17 +4,17 @@ namespace Anthropic { /// - /// A ping event in a streaming conversation. + /// /// - public sealed partial class PingEvent + public sealed partial class Ping { /// - /// The type of a streaming event. + /// Default Value: ping /// + /// global::Anthropic.PingType.Ping [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.MessageStreamEventType Type { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PingTypeJsonConverter))] + public global::Anthropic.PingType Type { get; set; } = global::Anthropic.PingType.Ping; /// /// Additional properties that are not explicitly defined in the schema @@ -23,22 +23,22 @@ public sealed partial class PingEvent public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// The type of a streaming event. + /// Default Value: ping /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public PingEvent( - global::Anthropic.MessageStreamEventType type) + public Ping( + global::Anthropic.PingType type = global::Anthropic.PingType.Ping) { this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public PingEvent() + public Ping() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PingType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PingType.g.cs new file mode 100644 index 0000000..002192c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PingType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: ping + /// + public enum PingType + { + /// + /// + /// + Ping, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PingTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PingType value) + { + return value switch + { + PingType.Ping => "ping", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PingType? ToEnum(string value) + { + return value switch + { + "ping" => PingType.Ping, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaCreateMessageParams.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaCreateMessageParams.Json.g.cs new file mode 100644 index 0000000..0b6240d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaCreateMessageParams.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaCreateMessageParams + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaCreateMessageParams? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaCreateMessageParams), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaCreateMessageParams; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaCreateMessageParams? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaCreateMessageParams), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaCreateMessageParams; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaCreateMessageParams.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaCreateMessageParams.g.cs new file mode 100644 index 0000000..7a95000 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaCreateMessageParams.g.cs @@ -0,0 +1,397 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaCreateMessageParams + { + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("messages")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Messages { get; set; } + + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + ///
+ /// 1024 + [global::System.Text.Json.Serialization.JsonPropertyName("max_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int MaxTokens { get; set; } + + /// + /// An object describing metadata about the request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("metadata")] + public global::Anthropic.Metadata? Metadata { get; set; } + + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_sequences")] + public global::System.Collections.Generic.IList? StopSequences { get; set; } + + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stream")] + public bool? Stream { get; set; } + + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + ///
+ /// [] + [global::System.Text.Json.Serialization.JsonPropertyName("system")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? System { get; set; } + + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + ///
+ /// 1 + [global::System.Text.Json.Serialization.JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceJsonConverter))] + public global::Anthropic.ToolChoice? ToolChoice { get; set; } + + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("tools")] + public global::System.Collections.Generic.IList? Tools { get; set; } + + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + ///
+ /// 5 + [global::System.Text.Json.Serialization.JsonPropertyName("top_k")] + public int? TopK { get; set; } + + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + ///
+ /// 0.7 + [global::System.Text.Json.Serialization.JsonPropertyName("top_p")] + public double? TopP { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// Input messages.
+ /// Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
+ /// Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
+ /// If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
+ /// Example with a single `user` message:
+ /// ```json
+ /// [{"role": "user", "content": "Hello, Claude"}]
+ /// ```
+ /// Example with multiple conversational turns:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "Hello there."},
+ /// {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
+ /// {"role": "user", "content": "Can you explain LLMs in plain English?"},
+ /// ]
+ /// ```
+ /// Example with a partially-filled response from Claude:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("},
+ /// ]
+ /// ```
+ /// Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
+ /// ```json
+ /// {"role": "user", "content": "Hello, Claude"}
+ /// ```
+ /// ```json
+ /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
+ /// ```
+ /// Starting with Claude 3 models, you can also send image content blocks:
+ /// ```json
+ /// {"role": "user", "content": [
+ /// {
+ /// "type": "image",
+ /// "source": {
+ /// "type": "base64",
+ /// "media_type": "image/jpeg",
+ /// "data": "/9j/4AAQSkZJRg...",
+ /// }
+ /// },
+ /// {"type": "text", "text": "What is in this image?"}
+ /// ]}
+ /// ```
+ /// We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
+ /// See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
+ /// Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Different models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
+ /// Example: 1024 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Custom text sequences that will cause the model to stop generating.
+ /// Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
+ /// If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// + /// + /// System prompt.
+ /// A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
+ /// Example: [] + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. + /// + /// + /// Definitions of tools that the model may use.
+ /// If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
+ /// Each tool definition includes:
+ /// * `name`: Name of the tool.
+ /// * `description`: Optional, but strongly-recommended description of the tool.
+ /// * `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
+ /// For example, if you defined `tools` as:
+ /// ```json
+ /// [
+ /// {
+ /// "name": "get_stock_price",
+ /// "description": "Get the current stock price for a given ticker symbol.",
+ /// "input_schema": {
+ /// "type": "object",
+ /// "properties": {
+ /// "ticker": {
+ /// "type": "string",
+ /// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
+ /// }
+ /// },
+ /// "required": ["ticker"]
+ /// }
+ /// }
+ /// ]
+ /// ```
+ /// And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_use",
+ /// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "name": "get_stock_price",
+ /// "input": { "ticker": "^GSPC" }
+ /// }
+ /// ]
+ /// ```
+ /// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
+ /// ```json
+ /// [
+ /// {
+ /// "type": "tool_result",
+ /// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
+ /// "content": "259.75 USD"
+ /// }
+ /// ]
+ /// ```
+ /// Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
+ /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaCreateMessageParams( + global::Anthropic.Model model, + global::System.Collections.Generic.IList messages, + int maxTokens, + global::Anthropic.Metadata? metadata, + global::System.Collections.Generic.IList? stopSequences, + bool? stream, + global::Anthropic.AnyOf>? system, + double? temperature, + global::Anthropic.ToolChoice? toolChoice, + global::System.Collections.Generic.IList? tools, + int? topK, + double? topP) + { + this.Model = model; + this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages)); + this.MaxTokens = maxTokens; + this.Metadata = metadata; + this.StopSequences = stopSequences; + this.Stream = stream; + this.System = system; + this.Temperature = temperature; + this.ToolChoice = toolChoice; + this.Tools = tools; + this.TopK = topK; + this.TopP = topP; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaCreateMessageParams() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessage.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessage.Json.g.cs new file mode 100644 index 0000000..77b4cfb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaInputMessage + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaInputMessage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaInputMessage), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaInputMessage; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaInputMessage? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaInputMessage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaInputMessage; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessage.g.cs new file mode 100644 index 0000000..29957c6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessage.g.cs @@ -0,0 +1,56 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaInputMessage + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("role")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaInputMessageRoleJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.PromptCachingBetaInputMessageRole Role { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.AnyOf> Content { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaInputMessage( + global::Anthropic.PromptCachingBetaInputMessageRole role, + global::Anthropic.AnyOf> content) + { + this.Role = role; + this.Content = content; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaInputMessage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator.Json.g.cs new file mode 100644 index 0000000..2a3d37f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaInputMessageContentVariant2ItemDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator.g.cs new file mode 100644 index 0000000..848ef36 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaInputMessageContentVariant2ItemDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaInputMessageContentVariant2ItemDiscriminator( + global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaInputMessageContentVariant2ItemDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..acc0912 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,63 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType + { + /// + /// + /// + Image, + /// + /// + /// + Text, + /// + /// + /// + ToolResult, + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType value) + { + return value switch + { + PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.Image => "image", + PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.Text => "text", + PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.ToolResult => "tool_result", + PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? ToEnum(string value) + { + return value switch + { + "image" => PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.Image, + "text" => PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.Text, + "tool_result" => PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.ToolResult, + "tool_use" => PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageRole.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageRole.g.cs new file mode 100644 index 0000000..920457a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaInputMessageRole.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaInputMessageRole + { + /// + /// + /// + User, + /// + /// + /// + Assistant, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaInputMessageRoleExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaInputMessageRole value) + { + return value switch + { + PromptCachingBetaInputMessageRole.User => "user", + PromptCachingBetaInputMessageRole.Assistant => "assistant", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaInputMessageRole? ToEnum(string value) + { + return value switch + { + "user" => PromptCachingBetaInputMessageRole.User, + "assistant" => PromptCachingBetaInputMessageRole.Assistant, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessage.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessage.Json.g.cs new file mode 100644 index 0000000..74c7de0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaMessage + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaMessage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaMessage), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaMessage; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaMessage? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaMessage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaMessage; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessage.g.cs new file mode 100644 index 0000000..a92f631 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessage.g.cs @@ -0,0 +1,202 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaMessage + { + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time.
+ /// Example: msg_013Zva2CMHLNnXjNJJKqJ2EF + ///
+ /// msg_013Zva2CMHLNnXjNJJKqJ2EF + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message + ///
+ /// global::Anthropic.PromptCachingBetaMessageType.Message + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaMessageType Type { get; set; } = global::Anthropic.PromptCachingBetaMessageType.Message; + + /// + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant + ///
+ /// global::Anthropic.PromptCachingBetaMessageRole.Assistant + [global::System.Text.Json.Serialization.JsonPropertyName("role")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageRoleJsonConverter))] + public global::Anthropic.PromptCachingBetaMessageRole Role { get; set; } = global::Anthropic.PromptCachingBetaMessageRole.Assistant; + + /// + /// Content generated by the model.
+ /// This is an array of content blocks, each of which has a `type` that determines its shape.
+ /// Example:
+ /// ```json
+ /// [{"type": "text", "text": "Hi, I'm Claude."}]
+ /// ```
+ /// If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.
+ /// For example, if the input `messages` were:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("}
+ /// ]
+ /// ```
+ /// Then the response `content` might be:
+ /// ```json
+ /// [{"type": "text", "text": "B)"}]
+ /// ```
+ /// Example: [] + ///
+ /// [] + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Content { get; set; } + + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ModelJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Model Model { get; set; } + + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_reason")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStopReasonJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.PromptCachingBetaMessageStopReason? StopReason { get; set; } + + /// + /// Which custom stop sequence was generated, if any.
+ /// This value will be a non-null string if one of your custom stop sequences was generated. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("stop_sequence")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string? StopSequence { get; set; } + + /// + /// Billing and rate-limit usage.
+ /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("usage")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.PromptCachingBetaUsage Usage { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Unique object identifier.
+ /// The format and length of IDs may change over time.
+ /// Example: msg_013Zva2CMHLNnXjNJJKqJ2EF + /// + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message + /// + /// + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant + /// + /// + /// Content generated by the model.
+ /// This is an array of content blocks, each of which has a `type` that determines its shape.
+ /// Example:
+ /// ```json
+ /// [{"type": "text", "text": "Hi, I'm Claude."}]
+ /// ```
+ /// If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.
+ /// For example, if the input `messages` were:
+ /// ```json
+ /// [
+ /// {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
+ /// {"role": "assistant", "content": "The best answer is ("}
+ /// ]
+ /// ```
+ /// Then the response `content` might be:
+ /// ```json
+ /// [{"type": "text", "text": "B)"}]
+ /// ```
+ /// Example: [] + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + /// + /// + /// Which custom stop sequence was generated, if any.
+ /// This value will be a non-null string if one of your custom stop sequences was generated. + /// + /// + /// Billing and rate-limit usage.
+ /// Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
+ /// Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
+ /// For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaMessage( + string id, + global::System.Collections.Generic.IList content, + global::Anthropic.Model model, + global::Anthropic.PromptCachingBetaMessageStopReason? stopReason, + string? stopSequence, + global::Anthropic.PromptCachingBetaUsage usage, + global::Anthropic.PromptCachingBetaMessageType type = global::Anthropic.PromptCachingBetaMessageType.Message, + global::Anthropic.PromptCachingBetaMessageRole role = global::Anthropic.PromptCachingBetaMessageRole.Assistant) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + this.Model = model; + this.StopReason = stopReason; + this.StopSequence = stopSequence ?? throw new global::System.ArgumentNullException(nameof(stopSequence)); + this.Usage = usage ?? throw new global::System.ArgumentNullException(nameof(usage)); + this.Type = type; + this.Role = role; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaMessage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageRole.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageRole.g.cs new file mode 100644 index 0000000..c8c4a0a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageRole.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Conversational role of the generated message.
+ /// This will always be `"assistant"`.
+ /// Default Value: assistant + ///
+ public enum PromptCachingBetaMessageRole + { + /// + /// + /// + Assistant, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaMessageRoleExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaMessageRole value) + { + return value switch + { + PromptCachingBetaMessageRole.Assistant => "assistant", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaMessageRole? ToEnum(string value) + { + return value switch + { + "assistant" => PromptCachingBetaMessageRole.Assistant, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEvent.Json.g.cs new file mode 100644 index 0000000..779fbc8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaMessageStartEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaMessageStartEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaMessageStartEvent), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaMessageStartEvent; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaMessageStartEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaMessageStartEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaMessageStartEvent; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEvent.g.cs new file mode 100644 index 0000000..cf60839 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEvent.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaMessageStartEvent + { + /// + /// Default Value: message_start + /// + /// global::Anthropic.PromptCachingBetaMessageStartEventType.MessageStart + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStartEventTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaMessageStartEventType Type { get; set; } = global::Anthropic.PromptCachingBetaMessageStartEventType.MessageStart; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.PromptCachingBetaMessage Message { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: message_start + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaMessageStartEvent( + global::Anthropic.PromptCachingBetaMessage message, + global::Anthropic.PromptCachingBetaMessageStartEventType type = global::Anthropic.PromptCachingBetaMessageStartEventType.MessageStart) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaMessageStartEvent() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEventType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEventType.g.cs new file mode 100644 index 0000000..eaf5911 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStartEventType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: message_start + /// + public enum PromptCachingBetaMessageStartEventType + { + /// + /// + /// + MessageStart, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaMessageStartEventTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaMessageStartEventType value) + { + return value switch + { + PromptCachingBetaMessageStartEventType.MessageStart => "message_start", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaMessageStartEventType? ToEnum(string value) + { + return value switch + { + "message_start" => PromptCachingBetaMessageStartEventType.MessageStart, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStopReason.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStopReason.g.cs new file mode 100644 index 0000000..91070ef --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStopReason.g.cs @@ -0,0 +1,69 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The reason that we stopped.
+ /// This may be one the following values:
+ /// * `"end_turn"`: the model reached a natural stopping point
+ /// * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
+ /// * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
+ /// * `"tool_use"`: the model invoked one or more tools
+ /// In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + ///
+ public enum PromptCachingBetaMessageStopReason + { + /// + /// the model reached a natural stopping point + /// + EndTurn, + /// + /// we exceeded the requested `max_tokens` or the model's maximum + /// + MaxTokens, + /// + /// one of your provided custom `stop_sequences` was generated + /// + StopSequence, + /// + /// the model invoked one or more tools + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaMessageStopReasonExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaMessageStopReason value) + { + return value switch + { + PromptCachingBetaMessageStopReason.EndTurn => "end_turn", + PromptCachingBetaMessageStopReason.MaxTokens => "max_tokens", + PromptCachingBetaMessageStopReason.StopSequence => "stop_sequence", + PromptCachingBetaMessageStopReason.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaMessageStopReason? ToEnum(string value) + { + return value switch + { + "end_turn" => PromptCachingBetaMessageStopReason.EndTurn, + "max_tokens" => PromptCachingBetaMessageStopReason.MaxTokens, + "stop_sequence" => PromptCachingBetaMessageStopReason.StopSequence, + "tool_use" => PromptCachingBetaMessageStopReason.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEvent.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEvent.Json.g.cs new file mode 100644 index 0000000..81bbcc0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEvent.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public readonly partial struct PromptCachingBetaMessageStreamEvent + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaMessageStreamEvent? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaMessageStreamEvent), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaMessageStreamEvent?; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaMessageStreamEvent? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaMessageStreamEvent), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaMessageStreamEvent?; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEvent.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEvent.g.cs new file mode 100644 index 0000000..dc6c1ef --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEvent.g.cs @@ -0,0 +1,426 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct PromptCachingBetaMessageStreamEvent : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.PromptCachingBetaMessageStartEvent? MessageStart { get; init; } +#else + public global::Anthropic.PromptCachingBetaMessageStartEvent? MessageStart { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageStart))] +#endif + public bool IsMessageStart => MessageStart != null; + + /// + /// + /// + public static implicit operator PromptCachingBetaMessageStreamEvent(global::Anthropic.PromptCachingBetaMessageStartEvent value) => new PromptCachingBetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.PromptCachingBetaMessageStartEvent?(PromptCachingBetaMessageStreamEvent @this) => @this.MessageStart; + + /// + /// + /// + public PromptCachingBetaMessageStreamEvent(global::Anthropic.PromptCachingBetaMessageStartEvent? value) + { + MessageStart = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.MessageDeltaEvent? MessageDelta { get; init; } +#else + public global::Anthropic.MessageDeltaEvent? MessageDelta { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageDelta))] +#endif + public bool IsMessageDelta => MessageDelta != null; + + /// + /// + /// + public static implicit operator PromptCachingBetaMessageStreamEvent(global::Anthropic.MessageDeltaEvent value) => new PromptCachingBetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.MessageDeltaEvent?(PromptCachingBetaMessageStreamEvent @this) => @this.MessageDelta; + + /// + /// + /// + public PromptCachingBetaMessageStreamEvent(global::Anthropic.MessageDeltaEvent? value) + { + MessageDelta = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.MessageStopEvent? MessageStop { get; init; } +#else + public global::Anthropic.MessageStopEvent? MessageStop { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(MessageStop))] +#endif + public bool IsMessageStop => MessageStop != null; + + /// + /// + /// + public static implicit operator PromptCachingBetaMessageStreamEvent(global::Anthropic.MessageStopEvent value) => new PromptCachingBetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.MessageStopEvent?(PromptCachingBetaMessageStreamEvent @this) => @this.MessageStop; + + /// + /// + /// + public PromptCachingBetaMessageStreamEvent(global::Anthropic.MessageStopEvent? value) + { + MessageStop = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ContentBlockStartEvent? ContentBlockStart { get; init; } +#else + public global::Anthropic.ContentBlockStartEvent? ContentBlockStart { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ContentBlockStart))] +#endif + public bool IsContentBlockStart => ContentBlockStart != null; + + /// + /// + /// + public static implicit operator PromptCachingBetaMessageStreamEvent(global::Anthropic.ContentBlockStartEvent value) => new PromptCachingBetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ContentBlockStartEvent?(PromptCachingBetaMessageStreamEvent @this) => @this.ContentBlockStart; + + /// + /// + /// + public PromptCachingBetaMessageStreamEvent(global::Anthropic.ContentBlockStartEvent? value) + { + ContentBlockStart = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ContentBlockDeltaEvent? ContentBlockDelta { get; init; } +#else + public global::Anthropic.ContentBlockDeltaEvent? ContentBlockDelta { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ContentBlockDelta))] +#endif + public bool IsContentBlockDelta => ContentBlockDelta != null; + + /// + /// + /// + public static implicit operator PromptCachingBetaMessageStreamEvent(global::Anthropic.ContentBlockDeltaEvent value) => new PromptCachingBetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ContentBlockDeltaEvent?(PromptCachingBetaMessageStreamEvent @this) => @this.ContentBlockDelta; + + /// + /// + /// + public PromptCachingBetaMessageStreamEvent(global::Anthropic.ContentBlockDeltaEvent? value) + { + ContentBlockDelta = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ContentBlockStopEvent? ContentBlockStop { get; init; } +#else + public global::Anthropic.ContentBlockStopEvent? ContentBlockStop { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ContentBlockStop))] +#endif + public bool IsContentBlockStop => ContentBlockStop != null; + + /// + /// + /// + public static implicit operator PromptCachingBetaMessageStreamEvent(global::Anthropic.ContentBlockStopEvent value) => new PromptCachingBetaMessageStreamEvent(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ContentBlockStopEvent?(PromptCachingBetaMessageStreamEvent @this) => @this.ContentBlockStop; + + /// + /// + /// + public PromptCachingBetaMessageStreamEvent(global::Anthropic.ContentBlockStopEvent? value) + { + ContentBlockStop = value; + } + + /// + /// + /// + public PromptCachingBetaMessageStreamEvent( + global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType? type, + global::Anthropic.PromptCachingBetaMessageStartEvent? messageStart, + global::Anthropic.MessageDeltaEvent? messageDelta, + global::Anthropic.MessageStopEvent? messageStop, + global::Anthropic.ContentBlockStartEvent? contentBlockStart, + global::Anthropic.ContentBlockDeltaEvent? contentBlockDelta, + global::Anthropic.ContentBlockStopEvent? contentBlockStop + ) + { + Type = type; + + MessageStart = messageStart; + MessageDelta = messageDelta; + MessageStop = messageStop; + ContentBlockStart = contentBlockStart; + ContentBlockDelta = contentBlockDelta; + ContentBlockStop = contentBlockStop; + } + + /// + /// + /// + public object? Object => + ContentBlockStop as object ?? + ContentBlockDelta as object ?? + ContentBlockStart as object ?? + MessageStop as object ?? + MessageDelta as object ?? + MessageStart as object + ; + + /// + /// + /// + public bool Validate() + { + return IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && !IsMessageStop && IsContentBlockStart && !IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && IsContentBlockDelta && !IsContentBlockStop || !IsMessageStart && !IsMessageDelta && !IsMessageStop && !IsContentBlockStart && !IsContentBlockDelta && IsContentBlockStop; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? messageStart = null, + global::System.Func? messageDelta = null, + global::System.Func? messageStop = null, + global::System.Func? contentBlockStart = null, + global::System.Func? contentBlockDelta = null, + global::System.Func? contentBlockStop = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsMessageStart && messageStart != null) + { + return messageStart(MessageStart!); + } + else if (IsMessageDelta && messageDelta != null) + { + return messageDelta(MessageDelta!); + } + else if (IsMessageStop && messageStop != null) + { + return messageStop(MessageStop!); + } + else if (IsContentBlockStart && contentBlockStart != null) + { + return contentBlockStart(ContentBlockStart!); + } + else if (IsContentBlockDelta && contentBlockDelta != null) + { + return contentBlockDelta(ContentBlockDelta!); + } + else if (IsContentBlockStop && contentBlockStop != null) + { + return contentBlockStop(ContentBlockStop!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? messageStart = null, + global::System.Action? messageDelta = null, + global::System.Action? messageStop = null, + global::System.Action? contentBlockStart = null, + global::System.Action? contentBlockDelta = null, + global::System.Action? contentBlockStop = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsMessageStart) + { + messageStart?.Invoke(MessageStart!); + } + else if (IsMessageDelta) + { + messageDelta?.Invoke(MessageDelta!); + } + else if (IsMessageStop) + { + messageStop?.Invoke(MessageStop!); + } + else if (IsContentBlockStart) + { + contentBlockStart?.Invoke(ContentBlockStart!); + } + else if (IsContentBlockDelta) + { + contentBlockDelta?.Invoke(ContentBlockDelta!); + } + else if (IsContentBlockStop) + { + contentBlockStop?.Invoke(ContentBlockStop!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + MessageStart, + typeof(global::Anthropic.PromptCachingBetaMessageStartEvent), + MessageDelta, + typeof(global::Anthropic.MessageDeltaEvent), + MessageStop, + typeof(global::Anthropic.MessageStopEvent), + ContentBlockStart, + typeof(global::Anthropic.ContentBlockStartEvent), + ContentBlockDelta, + typeof(global::Anthropic.ContentBlockDeltaEvent), + ContentBlockStop, + typeof(global::Anthropic.ContentBlockStopEvent), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(PromptCachingBetaMessageStreamEvent other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageStart, other.MessageStart) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageDelta, other.MessageDelta) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(MessageStop, other.MessageStop) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockStart, other.ContentBlockStart) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockDelta, other.ContentBlockDelta) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(ContentBlockStop, other.ContentBlockStop) + ; + } + + /// + /// + /// + public static bool operator ==(PromptCachingBetaMessageStreamEvent obj1, PromptCachingBetaMessageStreamEvent obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(PromptCachingBetaMessageStreamEvent obj1, PromptCachingBetaMessageStreamEvent obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is PromptCachingBetaMessageStreamEvent o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminator.Json.g.cs new file mode 100644 index 0000000..0d8725a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaMessageStreamEventDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminator.g.cs new file mode 100644 index 0000000..47e816a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaMessageStreamEventDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaMessageStreamEventDiscriminator( + global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaMessageStreamEventDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminatorType.g.cs new file mode 100644 index 0000000..129d8aa --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageStreamEventDiscriminatorType.g.cs @@ -0,0 +1,75 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaMessageStreamEventDiscriminatorType + { + /// + /// + /// + ContentBlockDelta, + /// + /// + /// + ContentBlockStart, + /// + /// + /// + ContentBlockStop, + /// + /// + /// + MessageDelta, + /// + /// + /// + MessageStart, + /// + /// + /// + MessageStop, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaMessageStreamEventDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaMessageStreamEventDiscriminatorType value) + { + return value switch + { + PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockDelta => "content_block_delta", + PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockStart => "content_block_start", + PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockStop => "content_block_stop", + PromptCachingBetaMessageStreamEventDiscriminatorType.MessageDelta => "message_delta", + PromptCachingBetaMessageStreamEventDiscriminatorType.MessageStart => "message_start", + PromptCachingBetaMessageStreamEventDiscriminatorType.MessageStop => "message_stop", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaMessageStreamEventDiscriminatorType? ToEnum(string value) + { + return value switch + { + "content_block_delta" => PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockDelta, + "content_block_start" => PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockStart, + "content_block_stop" => PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockStop, + "message_delta" => PromptCachingBetaMessageStreamEventDiscriminatorType.MessageDelta, + "message_start" => PromptCachingBetaMessageStreamEventDiscriminatorType.MessageStart, + "message_stop" => PromptCachingBetaMessageStreamEventDiscriminatorType.MessageStop, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageType.g.cs new file mode 100644 index 0000000..a07ad88 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaMessageType.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Object type.
+ /// For Messages, this is always `"message"`.
+ /// Default Value: message + ///
+ public enum PromptCachingBetaMessageType + { + /// + /// + /// + Message, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaMessageTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaMessageType value) + { + return value switch + { + PromptCachingBetaMessageType.Message => "message", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaMessageType? ToEnum(string value) + { + return value switch + { + "message" => PromptCachingBetaMessageType.Message, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlock.Json.g.cs new file mode 100644 index 0000000..efc9bbf --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestImageBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestImageBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestImageBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestImageBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestImageBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlock.g.cs similarity index 54% rename from src/libs/Anthropic/Generated/Anthropic.Models.ImageBlock.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlock.g.cs index 2e59fa5..e139cab 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ImageBlock.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlock.g.cs @@ -4,31 +4,29 @@ namespace Anthropic { /// - /// A block of image content. + /// /// - public sealed partial class ImageBlock + public sealed partial class PromptCachingBetaRequestImageBlock { /// - /// The source of an image block. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("source")] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.ImageBlockSource Source { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } /// - /// The type of content block.
- /// Default Value: image + /// ///
- /// global::Anthropic.ImageBlockType.Image [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ImageBlockTypeJsonConverter))] - public global::Anthropic.ImageBlockType Type { get; set; } = global::Anthropic.ImageBlockType.Image; + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestImageBlockType Type { get; set; } /// - /// The cache control settings. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] - public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("source")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Base64ImageSource Source { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -37,33 +35,26 @@ public sealed partial class ImageBlock public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The source of an image block. - /// - /// - /// The type of content block.
- /// Default Value: image - /// - /// - /// The cache control settings. - /// + /// + /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ImageBlock( - global::Anthropic.ImageBlockSource source, + public PromptCachingBetaRequestImageBlock( + global::Anthropic.Base64ImageSource source, global::Anthropic.CacheControlEphemeral? cacheControl, - global::Anthropic.ImageBlockType type = global::Anthropic.ImageBlockType.Image) + global::Anthropic.PromptCachingBetaRequestImageBlockType type) { this.Source = source ?? throw new global::System.ArgumentNullException(nameof(source)); - this.Type = type; this.CacheControl = cacheControl; + this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ImageBlock() + public PromptCachingBetaRequestImageBlock() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..13b1362 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestImageBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..3cf3bed --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestImageBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestImageBlockCacheControlDiscriminator( + global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaRequestImageBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..dd127c1 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType value) + { + return value switch + { + PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminator.Json.g.cs new file mode 100644 index 0000000..ff845e7 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestImageBlockSourceDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminator.g.cs new file mode 100644 index 0000000..f385f2d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestImageBlockSourceDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestImageBlockSourceDiscriminator( + global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaRequestImageBlockSourceDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminatorType.g.cs new file mode 100644 index 0000000..b18bf5c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockSourceDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestImageBlockSourceDiscriminatorType + { + /// + /// + /// + Base64, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestImageBlockSourceDiscriminatorType value) + { + return value switch + { + PromptCachingBetaRequestImageBlockSourceDiscriminatorType.Base64 => "base64", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestImageBlockSourceDiscriminatorType? ToEnum(string value) + { + return value switch + { + "base64" => PromptCachingBetaRequestImageBlockSourceDiscriminatorType.Base64, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockType.g.cs new file mode 100644 index 0000000..d835748 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestImageBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestImageBlockType + { + /// + /// + /// + Image, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestImageBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestImageBlockType value) + { + return value switch + { + PromptCachingBetaRequestImageBlockType.Image => "image", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestImageBlockType? ToEnum(string value) + { + return value switch + { + "image" => PromptCachingBetaRequestImageBlockType.Image, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlock.Json.g.cs new file mode 100644 index 0000000..a61df7a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestTextBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestTextBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestTextBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestTextBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestTextBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlock.g.cs similarity index 59% rename from src/libs/Anthropic/Generated/Anthropic.Models.TextBlock.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlock.g.cs index 0036487..1aa6cb2 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlock.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlock.g.cs @@ -4,31 +4,29 @@ namespace Anthropic { /// - /// A block of text content. + /// /// - public sealed partial class TextBlock + public sealed partial class PromptCachingBetaRequestTextBlock { /// - /// The text content. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("text")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Text { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } /// - /// The type of content block.
- /// Default Value: text + /// ///
- /// global::Anthropic.TextBlockType.Text [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.TextBlockTypeJsonConverter))] - public global::Anthropic.TextBlockType Type { get; set; } = global::Anthropic.TextBlockType.Text; + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestTextBlockTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestTextBlockType Type { get; set; } /// - /// The cache control settings. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] - public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("text")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Text { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -37,33 +35,26 @@ public sealed partial class TextBlock public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The text content. - /// - /// - /// The type of content block.
- /// Default Value: text - /// - /// - /// The cache control settings. - /// + /// + /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public TextBlock( + public PromptCachingBetaRequestTextBlock( string text, global::Anthropic.CacheControlEphemeral? cacheControl, - global::Anthropic.TextBlockType type = global::Anthropic.TextBlockType.Text) + global::Anthropic.PromptCachingBetaRequestTextBlockType type) { this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); - this.Type = type; this.CacheControl = cacheControl; + this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public TextBlock() + public PromptCachingBetaRequestTextBlock() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..04e6ae6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestTextBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..8d2450f --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestTextBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestTextBlockCacheControlDiscriminator( + global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaRequestTextBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..e4180b8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType value) + { + return value switch + { + PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockType.g.cs new file mode 100644 index 0000000..e66641e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestTextBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestTextBlockType + { + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestTextBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestTextBlockType value) + { + return value switch + { + PromptCachingBetaRequestTextBlockType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestTextBlockType? ToEnum(string value) + { + return value switch + { + "text" => PromptCachingBetaRequestTextBlockType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlock.Json.g.cs new file mode 100644 index 0000000..36e9553 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestToolResultBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestToolResultBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlock), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestToolResultBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestToolResultBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestToolResultBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlock.g.cs new file mode 100644 index 0000000..2dc74fb --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlock.g.cs @@ -0,0 +1,82 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestToolResultBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestToolResultBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_use_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string ToolUseId { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("is_error")] + public bool? IsError { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? Content { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestToolResultBlock( + string toolUseId, + global::Anthropic.CacheControlEphemeral? cacheControl, + global::Anthropic.PromptCachingBetaRequestToolResultBlockType type, + bool? isError, + global::Anthropic.AnyOf>? content) + { + this.ToolUseId = toolUseId ?? throw new global::System.ArgumentNullException(nameof(toolUseId)); + this.CacheControl = cacheControl; + this.Type = type; + this.IsError = isError; + this.Content = content; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaRequestToolResultBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..ee679b2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..75bf69a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator( + global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..42e5608 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType value) + { + return value switch + { + PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs new file mode 100644 index 0000000..68ee18e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator.g.cs new file mode 100644 index 0000000..19ca4e3 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator( + global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..c18e48c --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType + { + /// + /// + /// + Image, + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType value) + { + return value switch + { + PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Image => "image", + PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? ToEnum(string value) + { + return value switch + { + "image" => PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Image, + "text" => PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockType.g.cs new file mode 100644 index 0000000..bfaef80 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolResultBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestToolResultBlockType + { + /// + /// + /// + ToolResult, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestToolResultBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestToolResultBlockType value) + { + return value switch + { + PromptCachingBetaRequestToolResultBlockType.ToolResult => "tool_result", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestToolResultBlockType? ToEnum(string value) + { + return value switch + { + "tool_result" => PromptCachingBetaRequestToolResultBlockType.ToolResult, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlock.Json.g.cs new file mode 100644 index 0000000..5af096d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestToolUseBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestToolUseBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlock), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestToolUseBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestToolUseBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestToolUseBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlock.g.cs similarity index 52% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlock.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlock.g.cs index e5b9928..dfffa8b 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlock.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlock.g.cs @@ -4,51 +4,44 @@ namespace Anthropic { /// - /// The tool the model wants to use. + /// /// - public sealed partial class ToolUseBlock + public sealed partial class PromptCachingBetaRequestToolUseBlock { /// - /// A unique identifier for this particular tool use block.
- /// This will be used to match up the tool results later.
- /// Example: toolu_01A09q90qw90lq917835lq9 + /// + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolUseBlockTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestToolUseBlockType Type { get; set; } + + /// + /// /// - /// toolu_01A09q90qw90lq917835lq9 [global::System.Text.Json.Serialization.JsonPropertyName("id")] [global::System.Text.Json.Serialization.JsonRequired] public required string Id { get; set; } /// - /// The name of the tool being used.
- /// Example: get_weather + /// ///
- /// get_weather [global::System.Text.Json.Serialization.JsonPropertyName("name")] [global::System.Text.Json.Serialization.JsonRequired] public required string Name { get; set; } /// - /// An object containing the input being passed to the tool, conforming to the tool's `input_schema`. + /// /// [global::System.Text.Json.Serialization.JsonPropertyName("input")] [global::System.Text.Json.Serialization.JsonRequired] public required object Input { get; set; } - /// - /// The type of content block.
- /// Default Value: tool_use - ///
- /// global::Anthropic.ToolUseBlockType.ToolUse - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolUseBlockTypeJsonConverter))] - public global::Anthropic.ToolUseBlockType Type { get; set; } = global::Anthropic.ToolUseBlockType.ToolUse; - - /// - /// The cache control settings. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] - public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } - /// /// Additional properties that are not explicitly defined in the schema /// @@ -56,46 +49,32 @@ public sealed partial class ToolUseBlock public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// A unique identifier for this particular tool use block.
- /// This will be used to match up the tool results later.
- /// Example: toolu_01A09q90qw90lq917835lq9 - /// - /// - /// The name of the tool being used.
- /// Example: get_weather - /// - /// - /// An object containing the input being passed to the tool, conforming to the tool's `input_schema`. - /// - /// - /// The type of content block.
- /// Default Value: tool_use - /// - /// - /// The cache control settings. - /// + /// + /// + /// + /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolUseBlock( + public PromptCachingBetaRequestToolUseBlock( string id, string name, object input, global::Anthropic.CacheControlEphemeral? cacheControl, - global::Anthropic.ToolUseBlockType type = global::Anthropic.ToolUseBlockType.ToolUse) + global::Anthropic.PromptCachingBetaRequestToolUseBlockType type) { this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); this.Input = input ?? throw new global::System.ArgumentNullException(nameof(input)); - this.Type = type; this.CacheControl = cacheControl; + this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ToolUseBlock() + public PromptCachingBetaRequestToolUseBlock() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..05a4501 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..d07a250 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator( + global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..52e4476 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType value) + { + return value switch + { + PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockInput.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockInput.Json.g.cs new file mode 100644 index 0000000..05dc7ef --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockInput.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaRequestToolUseBlockInput + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaRequestToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlockInput), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaRequestToolUseBlockInput; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaRequestToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlockInput), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaRequestToolUseBlockInput; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockInput.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockInput.g.cs new file mode 100644 index 0000000..3dada73 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockInput.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaRequestToolUseBlockInput + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaRequestToolUseBlockInput( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockType.g.cs new file mode 100644 index 0000000..e7eb2e6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaRequestToolUseBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaRequestToolUseBlockType + { + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaRequestToolUseBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaRequestToolUseBlockType value) + { + return value switch + { + PromptCachingBetaRequestToolUseBlockType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaRequestToolUseBlockType? ToEnum(string value) + { + return value switch + { + "tool_use" => PromptCachingBetaRequestToolUseBlockType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaTool.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaTool.Json.g.cs new file mode 100644 index 0000000..a3c1e4a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaTool.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaTool + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaTool? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaTool), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaTool; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaTool? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaTool), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaTool; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustom.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaTool.g.cs similarity index 57% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolCustom.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaTool.g.cs index 36f3a4f..a9b2147 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustom.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaTool.g.cs @@ -4,41 +4,40 @@ namespace Anthropic { /// - /// A custom tool the model may use. + /// /// - public sealed partial class ToolCustom + public sealed partial class PromptCachingBetaTool { /// - /// The type of tool. + /// Description of what this tool does.
+ /// Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
+ /// Example: Get the current weather in a given location ///
- [global::System.Text.Json.Serialization.JsonPropertyName("type")] - public string? Type { get; set; } + /// Get the current weather in a given location + [global::System.Text.Json.Serialization.JsonPropertyName("description")] + public string? Description { get; set; } /// - /// The name of the tool. Must match the regex `^[a-zA-Z0-9_-]{1,64}$`. + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. ///
[global::System.Text.Json.Serialization.JsonPropertyName("name")] [global::System.Text.Json.Serialization.JsonRequired] public required string Name { get; set; } - /// - /// Description of what this tool does.
- /// Tool descriptions should be as detailed as possible. The more information that
- /// the model has about what the tool is and how to use it, the better it will
- /// perform. You can use natural language descriptions to reinforce important
- /// aspects of the tool input JSON schema. - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("description")] - public string? Description { get; set; } - /// /// [JSON schema](https://json-schema.org/) for this tool's input.
- /// This defines the shape of the `input` that your tool accepts and that the model
- /// will produce. + /// This defines the shape of the `input` that your tool accepts and that the model will produce. ///
[global::System.Text.Json.Serialization.JsonPropertyName("input_schema")] [global::System.Text.Json.Serialization.JsonRequired] - public required object InputSchema { get; set; } + public required global::Anthropic.InputSchema InputSchema { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] + public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -47,43 +46,39 @@ public sealed partial class ToolCustom public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The type of tool. - /// - /// - /// The name of the tool. Must match the regex `^[a-zA-Z0-9_-]{1,64}$`. - /// /// /// Description of what this tool does.
- /// Tool descriptions should be as detailed as possible. The more information that
- /// the model has about what the tool is and how to use it, the better it will
- /// perform. You can use natural language descriptions to reinforce important
- /// aspects of the tool input JSON schema. + /// Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
+ /// Example: Get the current weather in a given location + /// + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. /// /// /// [JSON schema](https://json-schema.org/) for this tool's input.
- /// This defines the shape of the `input` that your tool accepts and that the model
- /// will produce. + /// This defines the shape of the `input` that your tool accepts and that the model will produce. /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolCustom( + public PromptCachingBetaTool( string name, - object inputSchema, - string? type, - string? description) + global::Anthropic.InputSchema inputSchema, + string? description, + global::Anthropic.CacheControlEphemeral? cacheControl) { this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); this.InputSchema = inputSchema ?? throw new global::System.ArgumentNullException(nameof(inputSchema)); - this.Type = type; this.Description = description; + this.CacheControl = cacheControl; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ToolCustom() + public PromptCachingBetaTool() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminator.Json.g.cs new file mode 100644 index 0000000..ad18af1 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaToolCacheControlDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaToolCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaToolCacheControlDiscriminator), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaToolCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaToolCacheControlDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaToolCacheControlDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaToolCacheControlDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminator.g.cs new file mode 100644 index 0000000..1dea75e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaToolCacheControlDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorTypeJsonConverter))] + public global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaToolCacheControlDiscriminator( + global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaToolCacheControlDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..22f8043 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaToolCacheControlDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum PromptCachingBetaToolCacheControlDiscriminatorType + { + /// + /// + /// + Ephemeral, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PromptCachingBetaToolCacheControlDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PromptCachingBetaToolCacheControlDiscriminatorType value) + { + return value switch + { + PromptCachingBetaToolCacheControlDiscriminatorType.Ephemeral => "ephemeral", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PromptCachingBetaToolCacheControlDiscriminatorType? ToEnum(string value) + { + return value switch + { + "ephemeral" => PromptCachingBetaToolCacheControlDiscriminatorType.Ephemeral, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaUsage.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaUsage.Json.g.cs new file mode 100644 index 0000000..9f1a65a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaUsage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class PromptCachingBetaUsage + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.PromptCachingBetaUsage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.PromptCachingBetaUsage), + jsonSerializerContext) as global::Anthropic.PromptCachingBetaUsage; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.PromptCachingBetaUsage? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.PromptCachingBetaUsage), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.PromptCachingBetaUsage; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaUsage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaUsage.g.cs new file mode 100644 index 0000000..79c2896 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.PromptCachingBetaUsage.g.cs @@ -0,0 +1,92 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class PromptCachingBetaUsage + { + /// + /// The number of input tokens which were used.
+ /// Example: 2095 + ///
+ /// 2095 + [global::System.Text.Json.Serialization.JsonPropertyName("input_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int InputTokens { get; set; } + + /// + /// The number of input tokens used to create the cache entry.
+ /// Example: 2051 + ///
+ /// 2051 + [global::System.Text.Json.Serialization.JsonPropertyName("cache_creation_input_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int? CacheCreationInputTokens { get; set; } + + /// + /// The number of input tokens read from the cache.
+ /// Example: 2051 + ///
+ /// 2051 + [global::System.Text.Json.Serialization.JsonPropertyName("cache_read_input_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int? CacheReadInputTokens { get; set; } + + /// + /// The number of output tokens which were used.
+ /// Example: 503 + ///
+ /// 503 + [global::System.Text.Json.Serialization.JsonPropertyName("output_tokens")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int OutputTokens { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The number of input tokens which were used.
+ /// Example: 2095 + /// + /// + /// The number of input tokens used to create the cache entry.
+ /// Example: 2051 + /// + /// + /// The number of input tokens read from the cache.
+ /// Example: 2051 + /// + /// + /// The number of output tokens which were used.
+ /// Example: 503 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromptCachingBetaUsage( + int inputTokens, + int? cacheCreationInputTokens, + int? cacheReadInputTokens, + int outputTokens) + { + this.InputTokens = inputTokens; + this.CacheCreationInputTokens = cacheCreationInputTokens; + this.CacheReadInputTokens = cacheReadInputTokens; + this.OutputTokens = outputTokens; + } + + /// + /// Initializes a new instance of the class. + /// + public PromptCachingBetaUsage() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlockDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitError.Json.g.cs similarity index 88% rename from src/libs/Anthropic/Generated/Anthropic.Models.TextBlockDelta.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.RateLimitError.Json.g.cs index fd0daa2..ee6b5d9 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlockDelta.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitError.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class TextBlockDelta + public sealed partial class RateLimitError { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.TextBlockDelta? FromJson( + public static global::Anthropic.RateLimitError? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.TextBlockDelta), - jsonSerializerContext) as global::Anthropic.TextBlockDelta; + typeof(global::Anthropic.RateLimitError), + jsonSerializerContext) as global::Anthropic.RateLimitError; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.TextBlockDelta? FromJson( + public static global::Anthropic.RateLimitError? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.TextBlockDelta), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.TextBlockDelta; + typeof(global::Anthropic.RateLimitError), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RateLimitError; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitError.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitError.g.cs new file mode 100644 index 0000000..8851910 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitError.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RateLimitError + { + /// + /// Default Value: rate_limit_error + /// + /// global::Anthropic.RateLimitErrorType.RateLimitError + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.RateLimitErrorTypeJsonConverter))] + public global::Anthropic.RateLimitErrorType Type { get; set; } = global::Anthropic.RateLimitErrorType.RateLimitError; + + /// + /// Default Value: Rate limited + /// + /// "Rate limited" + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } = "Rate limited"; + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: rate_limit_error + /// + /// + /// Default Value: Rate limited + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateLimitError( + string message, + global::Anthropic.RateLimitErrorType type = global::Anthropic.RateLimitErrorType.RateLimitError) + { + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public RateLimitError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitErrorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitErrorType.g.cs new file mode 100644 index 0000000..7e451fd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RateLimitErrorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: rate_limit_error + /// + public enum RateLimitErrorType + { + /// + /// + /// + RateLimitError, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class RateLimitErrorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this RateLimitErrorType value) + { + return value switch + { + RateLimitErrorType.RateLimitError => "rate_limit_error", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static RateLimitErrorType? ToEnum(string value) + { + return value switch + { + "rate_limit_error" => RateLimitErrorType.RateLimitError, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlock.Json.g.cs new file mode 100644 index 0000000..ab99638 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class RequestImageBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.RequestImageBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.RequestImageBlock), + jsonSerializerContext) as global::Anthropic.RequestImageBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.RequestImageBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.RequestImageBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RequestImageBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlock.g.cs new file mode 100644 index 0000000..c02bc76 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlock.g.cs @@ -0,0 +1,52 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RequestImageBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.RequestImageBlockTypeJsonConverter))] + public global::Anthropic.RequestImageBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("source")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.Base64ImageSource Source { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestImageBlock( + global::Anthropic.Base64ImageSource source, + global::Anthropic.RequestImageBlockType type) + { + this.Source = source ?? throw new global::System.ArgumentNullException(nameof(source)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public RequestImageBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminator.Json.g.cs new file mode 100644 index 0000000..34d6f2e --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class RequestImageBlockSourceDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.RequestImageBlockSourceDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.RequestImageBlockSourceDiscriminator), + jsonSerializerContext) as global::Anthropic.RequestImageBlockSourceDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.RequestImageBlockSourceDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.RequestImageBlockSourceDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RequestImageBlockSourceDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminator.g.cs new file mode 100644 index 0000000..dfb2bcd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RequestImageBlockSourceDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.RequestImageBlockSourceDiscriminatorTypeJsonConverter))] + public global::Anthropic.RequestImageBlockSourceDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestImageBlockSourceDiscriminator( + global::Anthropic.RequestImageBlockSourceDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public RequestImageBlockSourceDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminatorType.g.cs new file mode 100644 index 0000000..7f0567a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockSourceDiscriminatorType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum RequestImageBlockSourceDiscriminatorType + { + /// + /// + /// + Base64, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class RequestImageBlockSourceDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this RequestImageBlockSourceDiscriminatorType value) + { + return value switch + { + RequestImageBlockSourceDiscriminatorType.Base64 => "base64", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static RequestImageBlockSourceDiscriminatorType? ToEnum(string value) + { + return value switch + { + "base64" => RequestImageBlockSourceDiscriminatorType.Base64, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockType.g.cs new file mode 100644 index 0000000..727cfd6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestImageBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum RequestImageBlockType + { + /// + /// + /// + Image, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class RequestImageBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this RequestImageBlockType value) + { + return value switch + { + RequestImageBlockType.Image => "image", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static RequestImageBlockType? ToEnum(string value) + { + return value switch + { + "image" => RequestImageBlockType.Image, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlock.Json.g.cs new file mode 100644 index 0000000..d3a6d54 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class RequestTextBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.RequestTextBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.RequestTextBlock), + jsonSerializerContext) as global::Anthropic.RequestTextBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.RequestTextBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.RequestTextBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RequestTextBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlock.g.cs new file mode 100644 index 0000000..5524fc9 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlock.g.cs @@ -0,0 +1,52 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RequestTextBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.RequestTextBlockTypeJsonConverter))] + public global::Anthropic.RequestTextBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Text { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestTextBlock( + string text, + global::Anthropic.RequestTextBlockType type) + { + this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public RequestTextBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlockType.g.cs new file mode 100644 index 0000000..f023cd9 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestTextBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum RequestTextBlockType + { + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class RequestTextBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this RequestTextBlockType value) + { + return value switch + { + RequestTextBlockType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static RequestTextBlockType? ToEnum(string value) + { + return value switch + { + "text" => RequestTextBlockType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlock.Json.g.cs new file mode 100644 index 0000000..d3b8996 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class RequestToolResultBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.RequestToolResultBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.RequestToolResultBlock), + jsonSerializerContext) as global::Anthropic.RequestToolResultBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.RequestToolResultBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.RequestToolResultBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RequestToolResultBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlock.g.cs new file mode 100644 index 0000000..f2d0160 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlock.g.cs @@ -0,0 +1,73 @@ + +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RequestToolResultBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.RequestToolResultBlockTypeJsonConverter))] + public global::Anthropic.RequestToolResultBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_use_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string ToolUseId { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("is_error")] + public bool? IsError { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>))] + public global::Anthropic.AnyOf>? Content { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestToolResultBlock( + string toolUseId, + global::Anthropic.RequestToolResultBlockType type, + bool? isError, + global::Anthropic.AnyOf>? content) + { + this.ToolUseId = toolUseId ?? throw new global::System.ArgumentNullException(nameof(toolUseId)); + this.Type = type; + this.IsError = isError; + this.Content = content; + } + + /// + /// Initializes a new instance of the class. + /// + public RequestToolResultBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs new file mode 100644 index 0000000..a8328cd --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class RequestToolResultBlockContentVariant2ItemDiscriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator), + jsonSerializerContext) as global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminator.g.cs new file mode 100644 index 0000000..a5d41f7 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminator.g.cs @@ -0,0 +1,42 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RequestToolResultBlockContentVariant2ItemDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter))] + public global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestToolResultBlockContentVariant2ItemDiscriminator( + global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public RequestToolResultBlockContentVariant2ItemDiscriminator() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..35f5c01 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum RequestToolResultBlockContentVariant2ItemDiscriminatorType + { + /// + /// + /// + Image, + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class RequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this RequestToolResultBlockContentVariant2ItemDiscriminatorType value) + { + return value switch + { + RequestToolResultBlockContentVariant2ItemDiscriminatorType.Image => "image", + RequestToolResultBlockContentVariant2ItemDiscriminatorType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static RequestToolResultBlockContentVariant2ItemDiscriminatorType? ToEnum(string value) + { + return value switch + { + "image" => RequestToolResultBlockContentVariant2ItemDiscriminatorType.Image, + "text" => RequestToolResultBlockContentVariant2ItemDiscriminatorType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockType.g.cs new file mode 100644 index 0000000..1474572 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolResultBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum RequestToolResultBlockType + { + /// + /// + /// + ToolResult, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class RequestToolResultBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this RequestToolResultBlockType value) + { + return value switch + { + RequestToolResultBlockType.ToolResult => "tool_result", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static RequestToolResultBlockType? ToEnum(string value) + { + return value switch + { + "tool_result" => RequestToolResultBlockType.ToolResult, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlock.Json.g.cs new file mode 100644 index 0000000..a00e76a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class RequestToolUseBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.RequestToolUseBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.RequestToolUseBlock), + jsonSerializerContext) as global::Anthropic.RequestToolUseBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.RequestToolUseBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.RequestToolUseBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RequestToolUseBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlock.g.cs new file mode 100644 index 0000000..f012f1d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlock.g.cs @@ -0,0 +1,72 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RequestToolUseBlock + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.RequestToolUseBlockTypeJsonConverter))] + public global::Anthropic.RequestToolUseBlockType Type { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("input")] + [global::System.Text.Json.Serialization.JsonRequired] + public required object Input { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestToolUseBlock( + string id, + string name, + object input, + global::Anthropic.RequestToolUseBlockType type) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Input = input ?? throw new global::System.ArgumentNullException(nameof(input)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public RequestToolUseBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockInput.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockInput.Json.g.cs new file mode 100644 index 0000000..05feb1d --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockInput.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class RequestToolUseBlockInput + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.RequestToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.RequestToolUseBlockInput), + jsonSerializerContext) as global::Anthropic.RequestToolUseBlockInput; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.RequestToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.RequestToolUseBlockInput), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.RequestToolUseBlockInput; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockInput.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockInput.g.cs new file mode 100644 index 0000000..1efd247 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockInput.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class RequestToolUseBlockInput + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestToolUseBlockInput( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockType.g.cs new file mode 100644 index 0000000..89c85d8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.RequestToolUseBlockType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum RequestToolUseBlockType + { + /// + /// + /// + ToolUse, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class RequestToolUseBlockTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this RequestToolUseBlockType value) + { + return value switch + { + RequestToolUseBlockType.ToolUse => "tool_use", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static RequestToolUseBlockType? ToEnum(string value) + { + return value switch + { + "tool_use" => RequestToolUseBlockType.ToolUse, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlock.Json.g.cs new file mode 100644 index 0000000..960870a --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ResponseTextBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ResponseTextBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ResponseTextBlock), + jsonSerializerContext) as global::Anthropic.ResponseTextBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ResponseTextBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ResponseTextBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ResponseTextBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlock.g.cs new file mode 100644 index 0000000..4b191dc --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlock.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class ResponseTextBlock + { + /// + /// Default Value: text + /// + /// global::Anthropic.ResponseTextBlockType.Text + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ResponseTextBlockTypeJsonConverter))] + public global::Anthropic.ResponseTextBlockType Type { get; set; } = global::Anthropic.ResponseTextBlockType.Text; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Text { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: text + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResponseTextBlock( + string text, + global::Anthropic.ResponseTextBlockType type = global::Anthropic.ResponseTextBlockType.Text) + { + this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public ResponseTextBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlockType.g.cs similarity index 69% rename from src/libs/Anthropic/Generated/Anthropic.Models.TextBlockType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlockType.g.cs index bc0dbe1..6482d73 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlockType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseTextBlockType.g.cs @@ -4,10 +4,9 @@ namespace Anthropic { /// - /// The type of content block.
/// Default Value: text ///
- public enum TextBlockType + public enum ResponseTextBlockType { /// /// @@ -18,27 +17,27 @@ public enum TextBlockType /// /// Enum extensions to do fast conversions without the reflection. /// - public static class TextBlockTypeExtensions + public static class ResponseTextBlockTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this TextBlockType value) + public static string ToValueString(this ResponseTextBlockType value) { return value switch { - TextBlockType.Text => "text", + ResponseTextBlockType.Text => "text", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static TextBlockType? ToEnum(string value) + public static ResponseTextBlockType? ToEnum(string value) { return value switch { - "text" => TextBlockType.Text, + "text" => ResponseTextBlockType.Text, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlock.Json.g.cs new file mode 100644 index 0000000..4f7add5 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlock.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ResponseToolUseBlock + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ResponseToolUseBlock? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ResponseToolUseBlock), + jsonSerializerContext) as global::Anthropic.ResponseToolUseBlock; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ResponseToolUseBlock? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ResponseToolUseBlock), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ResponseToolUseBlock; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlock.g.cs new file mode 100644 index 0000000..def2dc5 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlock.g.cs @@ -0,0 +1,75 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class ResponseToolUseBlock + { + /// + /// Default Value: tool_use + /// + /// global::Anthropic.ResponseToolUseBlockType.ToolUse + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ResponseToolUseBlockTypeJsonConverter))] + public global::Anthropic.ResponseToolUseBlockType Type { get; set; } = global::Anthropic.ResponseToolUseBlockType.ToolUse; + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("input")] + [global::System.Text.Json.Serialization.JsonRequired] + public required object Input { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Default Value: tool_use + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResponseToolUseBlock( + string id, + string name, + object input, + global::Anthropic.ResponseToolUseBlockType type = global::Anthropic.ResponseToolUseBlockType.ToolUse) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Input = input ?? throw new global::System.ArgumentNullException(nameof(input)); + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public ResponseToolUseBlock() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockInput.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockInput.Json.g.cs new file mode 100644 index 0000000..0561da8 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockInput.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ResponseToolUseBlockInput + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ResponseToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ResponseToolUseBlockInput), + jsonSerializerContext) as global::Anthropic.ResponseToolUseBlockInput; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ResponseToolUseBlockInput? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ResponseToolUseBlockInput), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ResponseToolUseBlockInput; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockInput.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockInput.g.cs new file mode 100644 index 0000000..4e3f706 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockInput.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public sealed partial class ResponseToolUseBlockInput + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResponseToolUseBlockInput( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockType.g.cs similarity index 67% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockType.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockType.g.cs index 1195dd3..01f0ce3 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlockType.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ResponseToolUseBlockType.g.cs @@ -4,10 +4,9 @@ namespace Anthropic { /// - /// The type of content block.
/// Default Value: tool_use ///
- public enum ToolUseBlockType + public enum ResponseToolUseBlockType { /// /// @@ -18,27 +17,27 @@ public enum ToolUseBlockType /// /// Enum extensions to do fast conversions without the reflection. /// - public static class ToolUseBlockTypeExtensions + public static class ResponseToolUseBlockTypeExtensions { /// /// Converts an enum to a string. /// - public static string ToValueString(this ToolUseBlockType value) + public static string ToValueString(this ResponseToolUseBlockType value) { return value switch { - ToolUseBlockType.ToolUse => "tool_use", + ResponseToolUseBlockType.ToolUse => "tool_use", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } /// /// Converts an string to a enum. /// - public static ToolUseBlockType? ToEnum(string value) + public static ResponseToolUseBlockType? ToEnum(string value) { return value switch { - "tool_use" => ToolUseBlockType.ToolUse, + "tool_use" => ResponseToolUseBlockType.ToolUse, _ => null, }; } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDelta.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDelta.Json.g.cs new file mode 100644 index 0000000..d86a1b6 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDelta.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class TextContentBlockDelta + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.TextContentBlockDelta? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.TextContentBlockDelta), + jsonSerializerContext) as global::Anthropic.TextContentBlockDelta; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.TextContentBlockDelta? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.TextContentBlockDelta), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.TextContentBlockDelta; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlockDelta.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDelta.g.cs similarity index 58% rename from src/libs/Anthropic/Generated/Anthropic.Models.TextBlockDelta.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDelta.g.cs index 7132720..7bebf12 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.TextBlockDelta.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDelta.g.cs @@ -4,25 +4,24 @@ namespace Anthropic { /// - /// A delta in a streaming text block. + /// /// - public sealed partial class TextBlockDelta + public sealed partial class TextContentBlockDelta { /// - /// The text delta. + /// Default Value: text_delta /// - [global::System.Text.Json.Serialization.JsonPropertyName("text")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Text { get; set; } + /// global::Anthropic.TextContentBlockDeltaType.TextDelta + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.TextContentBlockDeltaTypeJsonConverter))] + public global::Anthropic.TextContentBlockDeltaType Type { get; set; } = global::Anthropic.TextContentBlockDeltaType.TextDelta; /// - /// The type of content block.
- /// Default Value: text_delta + /// ///
- /// "text_delta" - [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonPropertyName("text")] [global::System.Text.Json.Serialization.JsonRequired] - public required string Type { get; set; } = "text_delta"; + public required string Text { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -31,28 +30,25 @@ public sealed partial class TextBlockDelta public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The text delta. - /// /// - /// The type of content block.
/// Default Value: text_delta /// + /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public TextBlockDelta( + public TextContentBlockDelta( string text, - string type) + global::Anthropic.TextContentBlockDeltaType type = global::Anthropic.TextContentBlockDeltaType.TextDelta) { this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); - this.Type = type ?? throw new global::System.ArgumentNullException(nameof(type)); + this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public TextBlockDelta() + public TextContentBlockDelta() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDeltaType.g.cs new file mode 100644 index 0000000..9449c71 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.TextContentBlockDeltaType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// Default Value: text_delta + /// + public enum TextContentBlockDeltaType + { + /// + /// + /// + TextDelta, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class TextContentBlockDeltaTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this TextContentBlockDeltaType value) + { + return value switch + { + TextContentBlockDeltaType.TextDelta => "text_delta", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static TextContentBlockDeltaType? ToEnum(string value) + { + return value switch + { + "text_delta" => TextContentBlockDeltaType.TextDelta, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Tool.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Tool.Json.g.cs index fd39d89..7c25ee4 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Tool.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Tool.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public readonly partial struct Tool + public sealed partial class Tool { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -41,7 +41,7 @@ public string ToJson( return global::System.Text.Json.JsonSerializer.Deserialize( json, typeof(global::Anthropic.Tool), - jsonSerializerContext) as global::Anthropic.Tool?; + jsonSerializerContext) as global::Anthropic.Tool; } /// @@ -70,7 +70,7 @@ public string ToJson( return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, typeof(global::Anthropic.Tool), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Tool?; + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.Tool; } /// diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Tool.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Tool.g.cs index 4787b80..453ae79 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Tool.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Tool.g.cs @@ -1,316 +1,76 @@ -#pragma warning disable CS0618 // Type or member is obsolete #nullable enable namespace Anthropic { /// - /// A tool the model may use. + /// /// - public readonly partial struct Tool : global::System.IEquatable + public sealed partial class Tool { /// - /// A custom tool the model may use. + /// Description of what this tool does.
+ /// Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
+ /// Example: Get the current weather in a given location ///
-#if NET6_0_OR_GREATER - public global::Anthropic.ToolCustom? Custom { get; init; } -#else - public global::Anthropic.ToolCustom? Custom { get; } -#endif + /// Get the current weather in a given location + [global::System.Text.Json.Serialization.JsonPropertyName("description")] + public string? Description { get; set; } /// - /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. ///
-#if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Custom))] -#endif - public bool IsCustom => Custom != null; + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } /// - /// + /// [JSON schema](https://json-schema.org/) for this tool's input.
+ /// This defines the shape of the `input` that your tool accepts and that the model will produce. ///
- public static implicit operator Tool(global::Anthropic.ToolCustom value) => new Tool(value); + [global::System.Text.Json.Serialization.JsonPropertyName("input_schema")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Anthropic.InputSchema InputSchema { get; set; } /// - /// + /// Additional properties that are not explicitly defined in the schema /// - public static implicit operator global::Anthropic.ToolCustom?(Tool @this) => @this.Custom; + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// - /// - public Tool(global::Anthropic.ToolCustom? value) - { - Custom = value; - } - - /// - /// A tool that uses a mouse and keyboard to interact with a computer, and take screenshots. - /// -#if NET6_0_OR_GREATER - public global::Anthropic.ToolComputerUse? ComputerUse { get; init; } -#else - public global::Anthropic.ToolComputerUse? ComputerUse { get; } -#endif - - /// - /// - /// -#if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ComputerUse))] -#endif - public bool IsComputerUse => ComputerUse != null; - - /// - /// - /// - public static implicit operator Tool(global::Anthropic.ToolComputerUse value) => new Tool(value); - - /// - /// - /// - public static implicit operator global::Anthropic.ToolComputerUse?(Tool @this) => @this.ComputerUse; - - /// - /// - /// - public Tool(global::Anthropic.ToolComputerUse? value) - { - ComputerUse = value; - } - - /// - /// A tool for viewing, creating and editing files. - /// -#if NET6_0_OR_GREATER - public global::Anthropic.ToolTextEditor? TextEditor { get; init; } -#else - public global::Anthropic.ToolTextEditor? TextEditor { get; } -#endif - - /// - /// - /// -#if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(TextEditor))] -#endif - public bool IsTextEditor => TextEditor != null; - - /// - /// - /// - public static implicit operator Tool(global::Anthropic.ToolTextEditor value) => new Tool(value); - - /// - /// - /// - public static implicit operator global::Anthropic.ToolTextEditor?(Tool @this) => @this.TextEditor; - - /// - /// - /// - public Tool(global::Anthropic.ToolTextEditor? value) - { - TextEditor = value; - } - - /// - /// A tool for running commands in a bash shell. - /// -#if NET6_0_OR_GREATER - public global::Anthropic.ToolBash? Bash { get; init; } -#else - public global::Anthropic.ToolBash? Bash { get; } -#endif - - /// - /// - /// -#if NET6_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Bash))] -#endif - public bool IsBash => Bash != null; - - /// - /// - /// - public static implicit operator Tool(global::Anthropic.ToolBash value) => new Tool(value); - - /// - /// - /// - public static implicit operator global::Anthropic.ToolBash?(Tool @this) => @this.Bash; - - /// - /// - /// - public Tool(global::Anthropic.ToolBash? value) - { - Bash = value; - } - - /// - /// + /// Initializes a new instance of the class. /// + /// + /// Description of what this tool does.
+ /// Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
+ /// Example: Get the current weather in a given location + /// + /// + /// Name of the tool.
+ /// This is how the tool will be called by the model and in tool_use blocks. + /// + /// + /// [JSON schema](https://json-schema.org/) for this tool's input.
+ /// This defines the shape of the `input` that your tool accepts and that the model will produce. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public Tool( - global::Anthropic.ToolCustom? custom, - global::Anthropic.ToolComputerUse? computerUse, - global::Anthropic.ToolTextEditor? textEditor, - global::Anthropic.ToolBash? bash - ) - { - Custom = custom; - ComputerUse = computerUse; - TextEditor = textEditor; - Bash = bash; - } - - /// - /// - /// - public object? Object => - Bash as object ?? - TextEditor as object ?? - ComputerUse as object ?? - Custom as object - ; - - /// - /// - /// - public bool Validate() - { - return IsCustom && !IsComputerUse && !IsTextEditor && !IsBash || !IsCustom && IsComputerUse && !IsTextEditor && !IsBash || !IsCustom && !IsComputerUse && IsTextEditor && !IsBash || !IsCustom && !IsComputerUse && !IsTextEditor && IsBash; - } - - /// - /// - /// - public TResult? Match( - global::System.Func? custom = null, - global::System.Func? computerUse = null, - global::System.Func? textEditor = null, - global::System.Func? bash = null, - bool validate = true) - { - if (validate) - { - Validate(); - } - - if (IsCustom && custom != null) - { - return custom(Custom!); - } - else if (IsComputerUse && computerUse != null) - { - return computerUse(ComputerUse!); - } - else if (IsTextEditor && textEditor != null) - { - return textEditor(TextEditor!); - } - else if (IsBash && bash != null) - { - return bash(Bash!); - } - - return default(TResult); - } - - /// - /// - /// - public void Match( - global::System.Action? custom = null, - global::System.Action? computerUse = null, - global::System.Action? textEditor = null, - global::System.Action? bash = null, - bool validate = true) - { - if (validate) - { - Validate(); - } - - if (IsCustom) - { - custom?.Invoke(Custom!); - } - else if (IsComputerUse) - { - computerUse?.Invoke(ComputerUse!); - } - else if (IsTextEditor) - { - textEditor?.Invoke(TextEditor!); - } - else if (IsBash) - { - bash?.Invoke(Bash!); - } - } - - /// - /// - /// - public override int GetHashCode() - { - var fields = new object?[] - { - Custom, - typeof(global::Anthropic.ToolCustom), - ComputerUse, - typeof(global::Anthropic.ToolComputerUse), - TextEditor, - typeof(global::Anthropic.ToolTextEditor), - Bash, - typeof(global::Anthropic.ToolBash), - }; - const int offset = unchecked((int)2166136261); - const int prime = 16777619; - static int HashCodeAggregator(int hashCode, object? value) => value == null - ? (hashCode ^ 0) * prime - : (hashCode ^ value.GetHashCode()) * prime; - - return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); - } - - /// - /// - /// - public bool Equals(Tool other) - { - return - global::System.Collections.Generic.EqualityComparer.Default.Equals(Custom, other.Custom) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(ComputerUse, other.ComputerUse) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(TextEditor, other.TextEditor) && - global::System.Collections.Generic.EqualityComparer.Default.Equals(Bash, other.Bash) - ; - } - - /// - /// - /// - public static bool operator ==(Tool obj1, Tool obj2) - { - return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); - } - - /// - /// - /// - public static bool operator !=(Tool obj1, Tool obj2) + string name, + global::Anthropic.InputSchema inputSchema, + string? description) { - return !(obj1 == obj2); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.InputSchema = inputSchema ?? throw new global::System.ArgumentNullException(nameof(inputSchema)); + this.Description = description; } /// - /// + /// Initializes a new instance of the class. /// - public override bool Equals(object? obj) + public Tool() { - return obj is Tool o && Equals(o); } } -} +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolBash.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolBash.g.cs deleted file mode 100644 index ecd9daa..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolBash.g.cs +++ /dev/null @@ -1,69 +0,0 @@ - -#nullable enable - -namespace Anthropic -{ - /// - /// A tool for running commands in a bash shell. - /// - public sealed partial class ToolBash - { - /// - /// The type of tool.
- /// Default Value: bash_20241022 - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("type")] - public string? Type { get; set; } - - /// - /// The name of the tool.
- /// Default Value: bash - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// The cache control settings. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] - public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// The type of tool.
- /// Default Value: bash_20241022 - /// - /// - /// The name of the tool.
- /// Default Value: bash - /// - /// - /// The cache control settings. - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolBash( - string? type, - string? name, - global::Anthropic.CacheControlEphemeral? cacheControl) - { - this.Type = type; - this.Name = name; - this.CacheControl = cacheControl; - } - - /// - /// Initializes a new instance of the class. - /// - public ToolBash() - { - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.Json.g.cs index ca0678e..711cc8b 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolChoice + public readonly partial struct ToolChoice { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -41,7 +41,7 @@ public string ToJson( return global::System.Text.Json.JsonSerializer.Deserialize( json, typeof(global::Anthropic.ToolChoice), - jsonSerializerContext) as global::Anthropic.ToolChoice; + jsonSerializerContext) as global::Anthropic.ToolChoice?; } /// @@ -70,7 +70,7 @@ public string ToJson( return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, typeof(global::Anthropic.ToolChoice), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolChoice; + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolChoice?; } /// diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.g.cs index 31049a0..4ed135e 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoice.g.cs @@ -1,79 +1,273 @@ +#pragma warning disable CS0618 // Type or member is obsolete #nullable enable namespace Anthropic { /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. + /// How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself. ///
- public sealed partial class ToolChoice + public readonly partial struct ToolChoice : global::System.IEquatable { /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn't force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. + /// ///
- [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceTypeJsonConverter))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.ToolChoiceType Type { get; set; } + public global::Anthropic.ToolChoiceDiscriminatorType? Type { get; } /// - /// The name of the tool to use. + /// The model will automatically decide whether to use tools. /// - [global::System.Text.Json.Serialization.JsonPropertyName("name")] - public string? Name { get; set; } +#if NET6_0_OR_GREATER + public global::Anthropic.ToolChoiceAuto? Auto { get; init; } +#else + public global::Anthropic.ToolChoiceAuto? Auto { get; } +#endif /// - /// Whether to disable parallel tool use. + /// /// - [global::System.Text.Json.Serialization.JsonPropertyName("disable_parallel_tool_use")] - public bool? DisableParallelToolUse { get; set; } +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Auto))] +#endif + public bool IsAuto => Auto != null; /// - /// Additional properties that are not explicitly defined in the schema + /// /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + public static implicit operator ToolChoice(global::Anthropic.ToolChoiceAuto value) => new ToolChoice(value); /// - /// Initializes a new instance of the class. + /// + /// + public static implicit operator global::Anthropic.ToolChoiceAuto?(ToolChoice @this) => @this.Auto; + + /// + /// + /// + public ToolChoice(global::Anthropic.ToolChoiceAuto? value) + { + Auto = value; + } + + /// + /// The model will use any available tools. + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ToolChoiceAny? Any { get; init; } +#else + public global::Anthropic.ToolChoiceAny? Any { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Any))] +#endif + public bool IsAny => Any != null; + + /// + /// + /// + public static implicit operator ToolChoice(global::Anthropic.ToolChoiceAny value) => new ToolChoice(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ToolChoiceAny?(ToolChoice @this) => @this.Any; + + /// + /// + /// + public ToolChoice(global::Anthropic.ToolChoiceAny? value) + { + Any = value; + } + + /// + /// The model will use the specified tool with `tool_choice.name`. + /// +#if NET6_0_OR_GREATER + public global::Anthropic.ToolChoiceTool? Tool { get; init; } +#else + public global::Anthropic.ToolChoiceTool? Tool { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Tool))] +#endif + public bool IsTool => Tool != null; + + /// + /// + /// + public static implicit operator ToolChoice(global::Anthropic.ToolChoiceTool value) => new ToolChoice(value); + + /// + /// + /// + public static implicit operator global::Anthropic.ToolChoiceTool?(ToolChoice @this) => @this.Tool; + + /// + /// + /// + public ToolChoice(global::Anthropic.ToolChoiceTool? value) + { + Tool = value; + } + + /// + /// /// - /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn't force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. - /// - /// - /// The name of the tool to use. - /// - /// - /// Whether to disable parallel tool use. - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ToolChoice( - global::Anthropic.ToolChoiceType type, - string? name, - bool? disableParallelToolUse) + global::Anthropic.ToolChoiceDiscriminatorType? type, + global::Anthropic.ToolChoiceAuto? auto, + global::Anthropic.ToolChoiceAny? any, + global::Anthropic.ToolChoiceTool? tool + ) + { + Type = type; + + Auto = auto; + Any = any; + Tool = tool; + } + + /// + /// + /// + public object? Object => + Tool as object ?? + Any as object ?? + Auto as object + ; + + /// + /// + /// + public bool Validate() + { + return IsAuto && !IsAny && !IsTool || !IsAuto && IsAny && !IsTool || !IsAuto && !IsAny && IsTool; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? auto = null, + global::System.Func? any = null, + global::System.Func? tool = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsAuto && auto != null) + { + return auto(Auto!); + } + else if (IsAny && any != null) + { + return any(Any!); + } + else if (IsTool && tool != null) + { + return tool(Tool!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? auto = null, + global::System.Action? any = null, + global::System.Action? tool = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsAuto) + { + auto?.Invoke(Auto!); + } + else if (IsAny) + { + any?.Invoke(Any!); + } + else if (IsTool) + { + tool?.Invoke(Tool!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Auto, + typeof(global::Anthropic.ToolChoiceAuto), + Any, + typeof(global::Anthropic.ToolChoiceAny), + Tool, + typeof(global::Anthropic.ToolChoiceTool), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ToolChoice other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Auto, other.Auto) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Any, other.Any) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Tool, other.Tool) + ; + } + + /// + /// + /// + public static bool operator ==(ToolChoice obj1, ToolChoice obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ToolChoice obj1, ToolChoice obj2) { - this.Type = type; - this.Name = name; - this.DisableParallelToolUse = disableParallelToolUse; + return !(obj1 == obj2); } /// - /// Initializes a new instance of the class. + /// /// - public ToolChoice() + public override bool Equals(object? obj) { + return obj is ToolChoice o && Equals(o); } } -} \ No newline at end of file +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlock.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAny.Json.g.cs similarity index 89% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlock.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAny.Json.g.cs index 35bba79..2bd2a7d 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolUseBlock.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAny.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolUseBlock + public sealed partial class ToolChoiceAny { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolUseBlock? FromJson( + public static global::Anthropic.ToolChoiceAny? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolUseBlock), - jsonSerializerContext) as global::Anthropic.ToolUseBlock; + typeof(global::Anthropic.ToolChoiceAny), + jsonSerializerContext) as global::Anthropic.ToolChoiceAny; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolUseBlock? FromJson( + public static global::Anthropic.ToolChoiceAny? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolUseBlock), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolUseBlock; + typeof(global::Anthropic.ToolChoiceAny), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolChoiceAny; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAny.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAny.g.cs new file mode 100644 index 0000000..7b20ae0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAny.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The model will use any available tools. + /// + public sealed partial class ToolChoiceAny + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceAnyTypeJsonConverter))] + public global::Anthropic.ToolChoiceAnyType Type { get; set; } + + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("disable_parallel_tool_use")] + public bool? DisableParallelToolUse { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolChoiceAny( + global::Anthropic.ToolChoiceAnyType type, + bool? disableParallelToolUse) + { + this.Type = type; + this.DisableParallelToolUse = disableParallelToolUse; + } + + /// + /// Initializes a new instance of the class. + /// + public ToolChoiceAny() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAnyType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAnyType.g.cs new file mode 100644 index 0000000..f6032a2 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAnyType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ToolChoiceAnyType + { + /// + /// + /// + Any, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ToolChoiceAnyTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ToolChoiceAnyType value) + { + return value switch + { + ToolChoiceAnyType.Any => "any", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ToolChoiceAnyType? ToEnum(string value) + { + return value switch + { + "any" => ToolChoiceAnyType.Any, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolTextEditor.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAuto.Json.g.cs similarity index 89% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolTextEditor.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAuto.Json.g.cs index e111f20..29ca01c 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolTextEditor.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAuto.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolTextEditor + public sealed partial class ToolChoiceAuto { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolTextEditor? FromJson( + public static global::Anthropic.ToolChoiceAuto? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolTextEditor), - jsonSerializerContext) as global::Anthropic.ToolTextEditor; + typeof(global::Anthropic.ToolChoiceAuto), + jsonSerializerContext) as global::Anthropic.ToolChoiceAuto; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolTextEditor? FromJson( + public static global::Anthropic.ToolChoiceAuto? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolTextEditor), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolTextEditor; + typeof(global::Anthropic.ToolChoiceAuto), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolChoiceAuto; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAuto.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAuto.g.cs new file mode 100644 index 0000000..b188653 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAuto.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The model will automatically decide whether to use tools. + /// + public sealed partial class ToolChoiceAuto + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceAutoTypeJsonConverter))] + public global::Anthropic.ToolChoiceAutoType Type { get; set; } + + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output at most one tool use. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("disable_parallel_tool_use")] + public bool? DisableParallelToolUse { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output at most one tool use. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolChoiceAuto( + global::Anthropic.ToolChoiceAutoType type, + bool? disableParallelToolUse) + { + this.Type = type; + this.DisableParallelToolUse = disableParallelToolUse; + } + + /// + /// Initializes a new instance of the class. + /// + public ToolChoiceAuto() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAutoType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAutoType.g.cs new file mode 100644 index 0000000..cbc0834 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceAutoType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ToolChoiceAutoType + { + /// + /// + /// + Auto, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ToolChoiceAutoTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ToolChoiceAutoType value) + { + return value switch + { + ToolChoiceAutoType.Auto => "auto", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ToolChoiceAutoType? ToEnum(string value) + { + return value switch + { + "auto" => ToolChoiceAutoType.Auto, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustomInputSchema.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminator.Json.g.cs similarity index 87% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolCustomInputSchema.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminator.Json.g.cs index bdb732f..490eb99 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustomInputSchema.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminator.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolCustomInputSchema + public sealed partial class ToolChoiceDiscriminator { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolCustomInputSchema? FromJson( + public static global::Anthropic.ToolChoiceDiscriminator? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolCustomInputSchema), - jsonSerializerContext) as global::Anthropic.ToolCustomInputSchema; + typeof(global::Anthropic.ToolChoiceDiscriminator), + jsonSerializerContext) as global::Anthropic.ToolChoiceDiscriminator; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolCustomInputSchema? FromJson( + public static global::Anthropic.ToolChoiceDiscriminator? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolCustomInputSchema), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolCustomInputSchema; + typeof(global::Anthropic.ToolChoiceDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolChoiceDiscriminator; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminator.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminator.g.cs similarity index 65% rename from src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminator.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminator.g.cs index 2fc6555..a0bbb94 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.BlockDeltaDiscriminator.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminator.g.cs @@ -6,14 +6,14 @@ namespace Anthropic /// /// /// - public sealed partial class BlockDeltaDiscriminator + public sealed partial class ToolChoiceDiscriminator { /// /// /// [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.BlockDeltaDiscriminatorTypeJsonConverter))] - public global::Anthropic.BlockDeltaDiscriminatorType? Type { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceDiscriminatorTypeJsonConverter))] + public global::Anthropic.ToolChoiceDiscriminatorType? Type { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -22,20 +22,20 @@ public sealed partial class BlockDeltaDiscriminator public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public BlockDeltaDiscriminator( - global::Anthropic.BlockDeltaDiscriminatorType? type) + public ToolChoiceDiscriminator( + global::Anthropic.ToolChoiceDiscriminatorType? type) { this.Type = type; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public BlockDeltaDiscriminator() + public ToolChoiceDiscriminator() { } } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminatorType.g.cs new file mode 100644 index 0000000..8380e42 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceDiscriminatorType.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ToolChoiceDiscriminatorType + { + /// + /// + /// + Any, + /// + /// + /// + Auto, + /// + /// + /// + Tool, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ToolChoiceDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ToolChoiceDiscriminatorType value) + { + return value switch + { + ToolChoiceDiscriminatorType.Any => "any", + ToolChoiceDiscriminatorType.Auto => "auto", + ToolChoiceDiscriminatorType.Tool => "tool", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ToolChoiceDiscriminatorType? ToEnum(string value) + { + return value switch + { + "any" => ToolChoiceDiscriminatorType.Any, + "auto" => ToolChoiceDiscriminatorType.Auto, + "tool" => ToolChoiceDiscriminatorType.Tool, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceTool.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceTool.Json.g.cs new file mode 100644 index 0000000..4f54fff --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceTool.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Anthropic +{ + public sealed partial class ToolChoiceTool + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Anthropic.ToolChoiceTool? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Anthropic.ToolChoiceTool), + jsonSerializerContext) as global::Anthropic.ToolChoiceTool; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Anthropic.ToolChoiceTool? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Anthropic.ToolChoiceTool), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolChoiceTool; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceTool.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceTool.g.cs new file mode 100644 index 0000000..d7c3933 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceTool.g.cs @@ -0,0 +1,67 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// The model will use the specified tool with `tool_choice.name`. + /// + public sealed partial class ToolChoiceTool + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolChoiceToolTypeJsonConverter))] + public global::Anthropic.ToolChoiceToolType Type { get; set; } + + /// + /// The name of the tool to use. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("disable_parallel_tool_use")] + public bool? DisableParallelToolUse { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// The name of the tool to use. + /// + /// + /// Whether to disable parallel tool use.
+ /// Defaults to `false`. If set to `true`, the model will output exactly one tool use. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolChoiceTool( + string name, + global::Anthropic.ToolChoiceToolType type, + bool? disableParallelToolUse) + { + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Type = type; + this.DisableParallelToolUse = disableParallelToolUse; + } + + /// + /// Initializes a new instance of the class. + /// + public ToolChoiceTool() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceToolType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceToolType.g.cs new file mode 100644 index 0000000..b2bfaa0 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceToolType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public enum ToolChoiceToolType + { + /// + /// + /// + Tool, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ToolChoiceToolTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ToolChoiceToolType value) + { + return value switch + { + ToolChoiceToolType.Tool => "tool", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ToolChoiceToolType? ToEnum(string value) + { + return value switch + { + "tool" => ToolChoiceToolType.Tool, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceType.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceType.g.cs deleted file mode 100644 index 7e1d00b..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolChoiceType.g.cs +++ /dev/null @@ -1,61 +0,0 @@ - -#nullable enable - -namespace Anthropic -{ - /// - /// How the model should use the provided tools. The model can use a specific tool,
- /// any available tool, or decide by itself.
- /// - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
- /// - `any`: tells Claude that it must use one of the provided tools, but doesn't force a particular tool.
- /// - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field. - ///
- public enum ToolChoiceType - { - /// - /// allows Claude to decide whether to call any provided tools or not. This is the default value. - /// - Auto, - /// - /// allows Claude to decide whether to call any provided tools or not. This is the default value. - /// - Any, - /// - /// allows Claude to decide whether to call any provided tools or not. This is the default value. - /// - Tool, - } - - /// - /// Enum extensions to do fast conversions without the reflection. - /// - public static class ToolChoiceTypeExtensions - { - /// - /// Converts an enum to a string. - /// - public static string ToValueString(this ToolChoiceType value) - { - return value switch - { - ToolChoiceType.Auto => "auto", - ToolChoiceType.Any => "any", - ToolChoiceType.Tool => "tool", - _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), - }; - } - /// - /// Converts an string to a enum. - /// - public static ToolChoiceType? ToEnum(string value) - { - return value switch - { - "auto" => ToolChoiceType.Auto, - "any" => ToolChoiceType.Any, - "tool" => ToolChoiceType.Tool, - _ => null, - }; - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlock.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlock.g.cs deleted file mode 100644 index b8e5c81..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolResultBlock.g.cs +++ /dev/null @@ -1,100 +0,0 @@ - -#pragma warning disable CS0618 // Type or member is obsolete - -#nullable enable - -namespace Anthropic -{ - /// - /// The result of using a tool. - /// - public sealed partial class ToolResultBlock - { - /// - /// The `id` of the tool use request this is a result for. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("tool_use_id")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string ToolUseId { get; set; } - - /// - /// The result of the tool, as a string (e.g. `"content": "15 degrees"`)
- /// or list of nested content blocks (e.g. `"content": [{"type": "text", "text": "15 degrees"}]`).
- /// These content blocks can use the text or image types. - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("content")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.OneOfJsonConverter>))] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::Anthropic.OneOf> Content { get; set; } - - /// - /// Set to `true` if the tool execution resulted in an error. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("is_error")] - public bool? IsError { get; set; } - - /// - /// The type of content block.
- /// Default Value: tool_result - ///
- /// global::Anthropic.ToolResultBlockType.ToolResult - [global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Anthropic.JsonConverters.ToolResultBlockTypeJsonConverter))] - public global::Anthropic.ToolResultBlockType Type { get; set; } = global::Anthropic.ToolResultBlockType.ToolResult; - - /// - /// The cache control settings. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] - public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// The `id` of the tool use request this is a result for. - /// - /// - /// The result of the tool, as a string (e.g. `"content": "15 degrees"`)
- /// or list of nested content blocks (e.g. `"content": [{"type": "text", "text": "15 degrees"}]`).
- /// These content blocks can use the text or image types. - /// - /// - /// Set to `true` if the tool execution resulted in an error. - /// - /// - /// The type of content block.
- /// Default Value: tool_result - /// - /// - /// The cache control settings. - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolResultBlock( - string toolUseId, - global::Anthropic.OneOf> content, - bool? isError, - global::Anthropic.CacheControlEphemeral? cacheControl, - global::Anthropic.ToolResultBlockType type = global::Anthropic.ToolResultBlockType.ToolResult) - { - this.ToolUseId = toolUseId ?? throw new global::System.ArgumentNullException(nameof(toolUseId)); - this.Content = content; - this.IsError = isError; - this.Type = type; - this.CacheControl = cacheControl; - } - - /// - /// Initializes a new instance of the class. - /// - public ToolResultBlock() - { - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolTextEditor.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolTextEditor.g.cs deleted file mode 100644 index 0c76cbd..0000000 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolTextEditor.g.cs +++ /dev/null @@ -1,69 +0,0 @@ - -#nullable enable - -namespace Anthropic -{ - /// - /// A tool for viewing, creating and editing files. - /// - public sealed partial class ToolTextEditor - { - /// - /// The type of tool.
- /// Default Value: text_editor_20241022 - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("type")] - public string? Type { get; set; } - - /// - /// The name of the tool.
- /// Default Value: str_replace_editor - ///
- [global::System.Text.Json.Serialization.JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// The cache control settings. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_control")] - public global::Anthropic.CacheControlEphemeral? CacheControl { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// The type of tool.
- /// Default Value: text_editor_20241022 - /// - /// - /// The name of the tool.
- /// Default Value: str_replace_editor - /// - /// - /// The cache control settings. - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public ToolTextEditor( - string? type, - string? name, - global::Anthropic.CacheControlEphemeral? cacheControl) - { - this.Type = type; - this.Name = name; - this.CacheControl = cacheControl; - } - - /// - /// Initializes a new instance of the class. - /// - public ToolTextEditor() - { - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolBash.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem.Json.g.cs similarity index 90% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolBash.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem.Json.g.cs index 452c647..60497bf 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolBash.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolBash + public readonly partial struct ToolsItem { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolBash? FromJson( + public static global::Anthropic.ToolsItem? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolBash), - jsonSerializerContext) as global::Anthropic.ToolBash; + typeof(global::Anthropic.ToolsItem), + jsonSerializerContext) as global::Anthropic.ToolsItem?; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolBash? FromJson( + public static global::Anthropic.ToolsItem? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolBash), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolBash; + typeof(global::Anthropic.ToolsItem), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolsItem?; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem.g.cs new file mode 100644 index 0000000..5034898 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem.g.cs @@ -0,0 +1,324 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ToolsItem : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaTool? Custom { get; init; } +#else + public global::Anthropic.BetaTool? Custom { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Custom))] +#endif + public bool IsCustom => Custom != null; + + /// + /// + /// + public static implicit operator ToolsItem(global::Anthropic.BetaTool value) => new ToolsItem(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaTool?(ToolsItem @this) => @this.Custom; + + /// + /// + /// + public ToolsItem(global::Anthropic.BetaTool? value) + { + Custom = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaComputerUseTool20241022? Computer20241022 { get; init; } +#else + public global::Anthropic.BetaComputerUseTool20241022? Computer20241022 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Computer20241022))] +#endif + public bool IsComputer20241022 => Computer20241022 != null; + + /// + /// + /// + public static implicit operator ToolsItem(global::Anthropic.BetaComputerUseTool20241022 value) => new ToolsItem(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaComputerUseTool20241022?(ToolsItem @this) => @this.Computer20241022; + + /// + /// + /// + public ToolsItem(global::Anthropic.BetaComputerUseTool20241022? value) + { + Computer20241022 = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaBashTool20241022? Bash20241022 { get; init; } +#else + public global::Anthropic.BetaBashTool20241022? Bash20241022 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Bash20241022))] +#endif + public bool IsBash20241022 => Bash20241022 != null; + + /// + /// + /// + public static implicit operator ToolsItem(global::Anthropic.BetaBashTool20241022 value) => new ToolsItem(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaBashTool20241022?(ToolsItem @this) => @this.Bash20241022; + + /// + /// + /// + public ToolsItem(global::Anthropic.BetaBashTool20241022? value) + { + Bash20241022 = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaTextEditor20241022? TextEditor20241022 { get; init; } +#else + public global::Anthropic.BetaTextEditor20241022? TextEditor20241022 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(TextEditor20241022))] +#endif + public bool IsTextEditor20241022 => TextEditor20241022 != null; + + /// + /// + /// + public static implicit operator ToolsItem(global::Anthropic.BetaTextEditor20241022 value) => new ToolsItem(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaTextEditor20241022?(ToolsItem @this) => @this.TextEditor20241022; + + /// + /// + /// + public ToolsItem(global::Anthropic.BetaTextEditor20241022? value) + { + TextEditor20241022 = value; + } + + /// + /// + /// + public ToolsItem( + global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType? type, + global::Anthropic.BetaTool? custom, + global::Anthropic.BetaComputerUseTool20241022? computer20241022, + global::Anthropic.BetaBashTool20241022? bash20241022, + global::Anthropic.BetaTextEditor20241022? textEditor20241022 + ) + { + Type = type; + + Custom = custom; + Computer20241022 = computer20241022; + Bash20241022 = bash20241022; + TextEditor20241022 = textEditor20241022; + } + + /// + /// + /// + public object? Object => + TextEditor20241022 as object ?? + Bash20241022 as object ?? + Computer20241022 as object ?? + Custom as object + ; + + /// + /// + /// + public bool Validate() + { + return IsCustom && !IsComputer20241022 && !IsBash20241022 && !IsTextEditor20241022 || !IsCustom && IsComputer20241022 && !IsBash20241022 && !IsTextEditor20241022 || !IsCustom && !IsComputer20241022 && IsBash20241022 && !IsTextEditor20241022 || !IsCustom && !IsComputer20241022 && !IsBash20241022 && IsTextEditor20241022; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? custom = null, + global::System.Func? computer20241022 = null, + global::System.Func? bash20241022 = null, + global::System.Func? textEditor20241022 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsCustom && custom != null) + { + return custom(Custom!); + } + else if (IsComputer20241022 && computer20241022 != null) + { + return computer20241022(Computer20241022!); + } + else if (IsBash20241022 && bash20241022 != null) + { + return bash20241022(Bash20241022!); + } + else if (IsTextEditor20241022 && textEditor20241022 != null) + { + return textEditor20241022(TextEditor20241022!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? custom = null, + global::System.Action? computer20241022 = null, + global::System.Action? bash20241022 = null, + global::System.Action? textEditor20241022 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsCustom) + { + custom?.Invoke(Custom!); + } + else if (IsComputer20241022) + { + computer20241022?.Invoke(Computer20241022!); + } + else if (IsBash20241022) + { + bash20241022?.Invoke(Bash20241022!); + } + else if (IsTextEditor20241022) + { + textEditor20241022?.Invoke(TextEditor20241022!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Custom, + typeof(global::Anthropic.BetaTool), + Computer20241022, + typeof(global::Anthropic.BetaComputerUseTool20241022), + Bash20241022, + typeof(global::Anthropic.BetaBashTool20241022), + TextEditor20241022, + typeof(global::Anthropic.BetaTextEditor20241022), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ToolsItem other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Custom, other.Custom) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Computer20241022, other.Computer20241022) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Bash20241022, other.Bash20241022) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(TextEditor20241022, other.TextEditor20241022) + ; + } + + /// + /// + /// + public static bool operator ==(ToolsItem obj1, ToolsItem obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ToolsItem obj1, ToolsItem obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ToolsItem o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustom.Json.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem2.Json.g.cs similarity index 89% rename from src/libs/Anthropic/Generated/Anthropic.Models.ToolCustom.Json.g.cs rename to src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem2.Json.g.cs index 866688b..42daea3 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.ToolCustom.Json.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem2.Json.g.cs @@ -2,7 +2,7 @@ namespace Anthropic { - public sealed partial class ToolCustom + public readonly partial struct ToolsItem2 { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::Anthropic.ToolCustom? FromJson( + public static global::Anthropic.ToolsItem2? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::Anthropic.ToolCustom), - jsonSerializerContext) as global::Anthropic.ToolCustom; + typeof(global::Anthropic.ToolsItem2), + jsonSerializerContext) as global::Anthropic.ToolsItem2?; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::Anthropic.ToolCustom? FromJson( + public static global::Anthropic.ToolsItem2? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::Anthropic.ToolCustom), - jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolCustom; + typeof(global::Anthropic.ToolsItem2), + jsonSerializerContext).ConfigureAwait(false)) as global::Anthropic.ToolsItem2?; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem2.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem2.g.cs new file mode 100644 index 0000000..2b24adf --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.Models.ToolsItem2.g.cs @@ -0,0 +1,324 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Anthropic +{ + /// + /// + /// + public readonly partial struct ToolsItem2 : global::System.IEquatable + { + /// + /// + /// + public global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType? Type { get; } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaTool? Custom { get; init; } +#else + public global::Anthropic.BetaTool? Custom { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Custom))] +#endif + public bool IsCustom => Custom != null; + + /// + /// + /// + public static implicit operator ToolsItem2(global::Anthropic.BetaTool value) => new ToolsItem2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaTool?(ToolsItem2 @this) => @this.Custom; + + /// + /// + /// + public ToolsItem2(global::Anthropic.BetaTool? value) + { + Custom = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaComputerUseTool20241022? Computer20241022 { get; init; } +#else + public global::Anthropic.BetaComputerUseTool20241022? Computer20241022 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Computer20241022))] +#endif + public bool IsComputer20241022 => Computer20241022 != null; + + /// + /// + /// + public static implicit operator ToolsItem2(global::Anthropic.BetaComputerUseTool20241022 value) => new ToolsItem2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaComputerUseTool20241022?(ToolsItem2 @this) => @this.Computer20241022; + + /// + /// + /// + public ToolsItem2(global::Anthropic.BetaComputerUseTool20241022? value) + { + Computer20241022 = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaBashTool20241022? Bash20241022 { get; init; } +#else + public global::Anthropic.BetaBashTool20241022? Bash20241022 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Bash20241022))] +#endif + public bool IsBash20241022 => Bash20241022 != null; + + /// + /// + /// + public static implicit operator ToolsItem2(global::Anthropic.BetaBashTool20241022 value) => new ToolsItem2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaBashTool20241022?(ToolsItem2 @this) => @this.Bash20241022; + + /// + /// + /// + public ToolsItem2(global::Anthropic.BetaBashTool20241022? value) + { + Bash20241022 = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public global::Anthropic.BetaTextEditor20241022? TextEditor20241022 { get; init; } +#else + public global::Anthropic.BetaTextEditor20241022? TextEditor20241022 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(TextEditor20241022))] +#endif + public bool IsTextEditor20241022 => TextEditor20241022 != null; + + /// + /// + /// + public static implicit operator ToolsItem2(global::Anthropic.BetaTextEditor20241022 value) => new ToolsItem2(value); + + /// + /// + /// + public static implicit operator global::Anthropic.BetaTextEditor20241022?(ToolsItem2 @this) => @this.TextEditor20241022; + + /// + /// + /// + public ToolsItem2(global::Anthropic.BetaTextEditor20241022? value) + { + TextEditor20241022 = value; + } + + /// + /// + /// + public ToolsItem2( + global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType? type, + global::Anthropic.BetaTool? custom, + global::Anthropic.BetaComputerUseTool20241022? computer20241022, + global::Anthropic.BetaBashTool20241022? bash20241022, + global::Anthropic.BetaTextEditor20241022? textEditor20241022 + ) + { + Type = type; + + Custom = custom; + Computer20241022 = computer20241022; + Bash20241022 = bash20241022; + TextEditor20241022 = textEditor20241022; + } + + /// + /// + /// + public object? Object => + TextEditor20241022 as object ?? + Bash20241022 as object ?? + Computer20241022 as object ?? + Custom as object + ; + + /// + /// + /// + public bool Validate() + { + return IsCustom && !IsComputer20241022 && !IsBash20241022 && !IsTextEditor20241022 || !IsCustom && IsComputer20241022 && !IsBash20241022 && !IsTextEditor20241022 || !IsCustom && !IsComputer20241022 && IsBash20241022 && !IsTextEditor20241022 || !IsCustom && !IsComputer20241022 && !IsBash20241022 && IsTextEditor20241022; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? custom = null, + global::System.Func? computer20241022 = null, + global::System.Func? bash20241022 = null, + global::System.Func? textEditor20241022 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsCustom && custom != null) + { + return custom(Custom!); + } + else if (IsComputer20241022 && computer20241022 != null) + { + return computer20241022(Computer20241022!); + } + else if (IsBash20241022 && bash20241022 != null) + { + return bash20241022(Bash20241022!); + } + else if (IsTextEditor20241022 && textEditor20241022 != null) + { + return textEditor20241022(TextEditor20241022!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? custom = null, + global::System.Action? computer20241022 = null, + global::System.Action? bash20241022 = null, + global::System.Action? textEditor20241022 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsCustom) + { + custom?.Invoke(Custom!); + } + else if (IsComputer20241022) + { + computer20241022?.Invoke(Computer20241022!); + } + else if (IsBash20241022) + { + bash20241022?.Invoke(Bash20241022!); + } + else if (IsTextEditor20241022) + { + textEditor20241022?.Invoke(TextEditor20241022!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Custom, + typeof(global::Anthropic.BetaTool), + Computer20241022, + typeof(global::Anthropic.BetaComputerUseTool20241022), + Bash20241022, + typeof(global::Anthropic.BetaBashTool20241022), + TextEditor20241022, + typeof(global::Anthropic.BetaTextEditor20241022), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(ToolsItem2 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Custom, other.Custom) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Computer20241022, other.Computer20241022) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Bash20241022, other.Bash20241022) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(TextEditor20241022, other.TextEditor20241022) + ; + } + + /// + /// + /// + public static bool operator ==(ToolsItem2 obj1, ToolsItem2 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(ToolsItem2 obj1, ToolsItem2 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is ToolsItem2 o && Equals(o); + } + } +} diff --git a/src/libs/Anthropic/Generated/Anthropic.Models.Usage.g.cs b/src/libs/Anthropic/Generated/Anthropic.Models.Usage.g.cs index 0a8b53e..c78abae 100644 --- a/src/libs/Anthropic/Generated/Anthropic.Models.Usage.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.Models.Usage.g.cs @@ -4,44 +4,28 @@ namespace Anthropic { /// - /// Billing and rate-limit usage.
- /// Anthropic's API bills and rate-limits by token counts, as tokens represent the
- /// underlying cost to our systems.
- /// Under the hood, the API transforms requests into a format suitable for the
- /// model. The model's output then goes through a parsing stage before becoming an
- /// API response. As a result, the token counts in `usage` will not match one-to-one
- /// with the exact visible content of an API request or response.
- /// For example, `output_tokens` will be non-zero, even for an empty string response
- /// from Claude. + /// ///
public sealed partial class Usage { /// - /// The number of input tokens which were used. + /// The number of input tokens which were used.
+ /// Example: 2095 ///
+ /// 2095 [global::System.Text.Json.Serialization.JsonPropertyName("input_tokens")] [global::System.Text.Json.Serialization.JsonRequired] public required int InputTokens { get; set; } /// - /// The number of output tokens which were used. + /// The number of output tokens which were used.
+ /// Example: 503 ///
+ /// 503 [global::System.Text.Json.Serialization.JsonPropertyName("output_tokens")] [global::System.Text.Json.Serialization.JsonRequired] public required int OutputTokens { get; set; } - /// - /// The number of input tokens read from the cache. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_creation_input_tokens")] - public int? CacheCreationInputTokens { get; set; } - - /// - /// The number of input tokens used to create the cache entry. - /// - [global::System.Text.Json.Serialization.JsonPropertyName("cache_read_input_tokens")] - public int? CacheReadInputTokens { get; set; } - /// /// Additional properties that are not explicitly defined in the schema /// @@ -52,28 +36,20 @@ public sealed partial class Usage /// Initializes a new instance of the class. ///
/// - /// The number of input tokens which were used. + /// The number of input tokens which were used.
+ /// Example: 2095 /// /// - /// The number of output tokens which were used. - /// - /// - /// The number of input tokens read from the cache. - /// - /// - /// The number of input tokens used to create the cache entry. + /// The number of output tokens which were used.
+ /// Example: 503 /// [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public Usage( int inputTokens, - int outputTokens, - int? cacheCreationInputTokens, - int? cacheReadInputTokens) + int outputTokens) { this.InputTokens = inputTokens; this.OutputTokens = outputTokens; - this.CacheCreationInputTokens = cacheCreationInputTokens; - this.CacheReadInputTokens = cacheReadInputTokens; } /// diff --git a/src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.CompletePost.g.cs b/src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.CompletePost.g.cs new file mode 100644 index 0000000..90bb498 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.CompletePost.g.cs @@ -0,0 +1,298 @@ + +#nullable enable + +namespace Anthropic +{ + public partial class TextCompletionsClient + { + partial void PrepareCompletePostArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? anthropicVersion, + global::Anthropic.CompletionRequest request); + partial void PrepareCompletePostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? anthropicVersion, + global::Anthropic.CompletionRequest request); + partial void ProcessCompletePostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessCompletePostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create a Text Completion
+ /// [Legacy] Create a Text Completion.
+ /// The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
+ /// Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CompletePostAsync( + global::Anthropic.CompletionRequest request, + string? anthropicVersion = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareCompletePostArguments( + httpClient: HttpClient, + anthropicVersion: ref anthropicVersion, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/v1/complete", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + 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)); +#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()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCompletePostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + anthropicVersion: anthropicVersion, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessCompletePostResponse( + 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.ErrorResponse? __value_4XX = null; + if (ReadResponseAsString) + { + __content_4XX = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = global::Anthropic.ErrorResponse.FromJson(__content_4XX, JsonSerializerContext); + } + else + { + var __contentStream_4XX = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_4XX = await global::Anthropic.ErrorResponse.FromJsonStreamAsync(__contentStream_4XX, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::Anthropic.ApiException( + 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); + ProcessCompletePostResponseContent( + 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.CompletionResponse.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.CompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Create a Text Completion
+ /// [Legacy] Create a Text Completion.
+ /// The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
+ /// Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + ///
+ /// + /// The version of the Anthropic API you want to use.
+ /// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). + /// + /// + /// The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + /// + /// + /// The prompt that you want Claude to complete.
+ /// For proper response generation you will need to format your prompt using alternating `\n\nHuman:` and `\n\nAssistant:` conversational turns. For example:
+ /// ```
+ /// "\n\nHuman: {userQuestion}\n\nAssistant:"
+ /// ```
+ /// See [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more details.
+ /// Example:
+ /// Human: Hello, world!
+ /// Assistant: + /// + /// + /// The maximum number of tokens to generate before stopping.
+ /// Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
+ /// Example: 256 + /// + /// + /// Sequences that will cause the model to stop generating.
+ /// Our models stop on `"\n\nHuman:"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating. + /// + /// + /// Amount of randomness injected into the response.
+ /// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
+ /// Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
+ /// Example: 1 + /// + /// + /// Use nucleus sampling.
+ /// In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 0.7 + /// + /// + /// Only sample from the top K options for each subsequent token.
+ /// Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
+ /// Recommended for advanced use cases only. You usually only need to use `temperature`.
+ /// Example: 5 + /// + /// + /// An object describing metadata about the request. + /// + /// + /// Whether to incrementally stream the response using server-sent events.
+ /// See [streaming](https://docs.anthropic.com/en/api/streaming) for details. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CompletePostAsync( + global::Anthropic.Model model, + string prompt, + int maxTokensToSample, + string? anthropicVersion = default, + global::System.Collections.Generic.IList? stopSequences = default, + double? temperature = default, + double? topP = default, + int? topK = default, + global::Anthropic.Metadata? metadata = default, + bool? stream = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Anthropic.CompletionRequest + { + Model = model, + Prompt = prompt, + MaxTokensToSample = maxTokensToSample, + StopSequences = stopSequences, + Temperature = temperature, + TopP = topP, + TopK = topK, + Metadata = metadata, + Stream = stream, + }; + + return await CompletePostAsync( + anthropicVersion: anthropicVersion, + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.g.cs b/src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.g.cs new file mode 100644 index 0000000..2360878 --- /dev/null +++ b/src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.g.cs @@ -0,0 +1,86 @@ + +#nullable enable + +namespace Anthropic +{ + /// + /// 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 TextCompletionsClient : global::Anthropic.ITextCompletionsClient, global::System.IDisposable + { + /// + /// + /// + public const string DefaultBaseUrl = "https://api.anthropic.com"; + + 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; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Anthropic.SourceGenerationContext.Default; + + + /// + /// Creates a new instance of the TextCompletionsClient. + /// 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 TextCompletionsClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = 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(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.TextBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.APIErrorType.g.cs similarity index 71% rename from src/libs/Anthropic/Generated/JsonConverters.TextBlockType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.APIErrorType.g.cs index a3e366e..5d382f5 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.TextBlockType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.APIErrorType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class TextBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class APIErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.TextBlockType Read( + public override global::Anthropic.APIErrorType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class TextBlockTypeJsonConverter : global::System.Text.Json.Serial var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.TextBlockTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.APIErrorTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class TextBlockTypeJsonConverter : global::System.Text.Json.Serial case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.TextBlockType)numValue; + return (global::Anthropic.APIErrorType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class TextBlockTypeJsonConverter : global::System.Text.Json.Serial /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.TextBlockType value, + global::Anthropic.APIErrorType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.TextBlockTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.APIErrorTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.TextBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.APIErrorTypeNullable.g.cs similarity index 72% rename from src/libs/Anthropic/Generated/JsonConverters.TextBlockTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.APIErrorTypeNullable.g.cs index 0d8defa..c4c5036 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.TextBlockTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.APIErrorTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class TextBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class APIErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.TextBlockType? Read( + public override global::Anthropic.APIErrorType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class TextBlockTypeNullableJsonConverter : global::System.Text.Jso var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.TextBlockTypeExtensions.ToEnum(stringValue); + return global::Anthropic.APIErrorTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class TextBlockTypeNullableJsonConverter : global::System.Text.Jso case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.TextBlockType)numValue; + return (global::Anthropic.APIErrorType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class TextBlockTypeNullableJsonConverter : global::System.Text.Jso /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.TextBlockType? value, + global::Anthropic.APIErrorType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.TextBlockTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.APIErrorTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.AnthropicBeta.g.cs b/src/libs/Anthropic/Generated/JsonConverters.AnthropicBeta.g.cs new file mode 100644 index 0000000..c5f696d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.AnthropicBeta.g.cs @@ -0,0 +1,87 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class AnthropicBetaJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.AnthropicBeta Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + var + readerCopy = reader; + string? value1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); + value1 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + + readerCopy = reader; + global::Anthropic.AnthropicBetaEnum? value2 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.AnthropicBetaEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.AnthropicBetaEnum).Name}"); + value2 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + + var result = new global::Anthropic.AnthropicBeta( + value1, + value2 + ); + + if (value1 != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (value2 != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.AnthropicBetaEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.AnthropicBetaEnum).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.AnthropicBeta value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsValue1) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo); + } + else if (value.IsValue2) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.AnthropicBetaEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.AnthropicBetaEnum).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.AnthropicBetaEnum.g.cs b/src/libs/Anthropic/Generated/JsonConverters.AnthropicBetaEnum.g.cs new file mode 100644 index 0000000..bcfb512 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.AnthropicBetaEnum.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class AnthropicBetaEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.AnthropicBetaEnum Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.AnthropicBetaEnumExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.AnthropicBetaEnum)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.AnthropicBetaEnum value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.AnthropicBetaEnumExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.AnthropicBetaEnumNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.AnthropicBetaEnumNullable.g.cs new file mode 100644 index 0000000..6a911d9 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.AnthropicBetaEnumNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class AnthropicBetaEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.AnthropicBetaEnum? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.AnthropicBetaEnumExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.AnthropicBetaEnum)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.AnthropicBetaEnum? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.AnthropicBetaEnumExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.AuthenticationErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.AuthenticationErrorType.g.cs new file mode 100644 index 0000000..170cb3b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.AuthenticationErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class AuthenticationErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.AuthenticationErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.AuthenticationErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.AuthenticationErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.AuthenticationErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.AuthenticationErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.AuthenticationErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.AuthenticationErrorTypeNullable.g.cs new file mode 100644 index 0000000..7920c20 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.AuthenticationErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class AuthenticationErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.AuthenticationErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.AuthenticationErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.AuthenticationErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.AuthenticationErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.AuthenticationErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceMediaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceMediaType.g.cs new file mode 100644 index 0000000..9ed84e3 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceMediaType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class Base64ImageSourceMediaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.Base64ImageSourceMediaType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.Base64ImageSourceMediaTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.Base64ImageSourceMediaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.Base64ImageSourceMediaType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.Base64ImageSourceMediaTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceMediaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceMediaTypeNullable.g.cs new file mode 100644 index 0000000..5add32d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceMediaTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class Base64ImageSourceMediaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.Base64ImageSourceMediaType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.Base64ImageSourceMediaTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.Base64ImageSourceMediaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.Base64ImageSourceMediaType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.Base64ImageSourceMediaTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceType.g.cs new file mode 100644 index 0000000..552f764 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class Base64ImageSourceTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.Base64ImageSourceType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.Base64ImageSourceTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.Base64ImageSourceType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.Base64ImageSourceType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.Base64ImageSourceTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceTypeNullable.g.cs new file mode 100644 index 0000000..52e0b9f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.Base64ImageSourceTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class Base64ImageSourceTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.Base64ImageSourceType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.Base64ImageSourceTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.Base64ImageSourceType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.Base64ImageSourceType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.Base64ImageSourceTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaAPIErrorType.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.ToolUseBlockType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaAPIErrorType.g.cs index 3bfc36b..0e3a980 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ToolUseBlockType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaAPIErrorType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ToolUseBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaAPIErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ToolUseBlockType Read( + public override global::Anthropic.BetaAPIErrorType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ToolUseBlockTypeJsonConverter : global::System.Text.Json.Ser var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ToolUseBlockTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaAPIErrorTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class ToolUseBlockTypeJsonConverter : global::System.Text.Json.Ser case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ToolUseBlockType)numValue; + return (global::Anthropic.BetaAPIErrorType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class ToolUseBlockTypeJsonConverter : global::System.Text.Json.Ser /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ToolUseBlockType value, + global::Anthropic.BetaAPIErrorType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.ToolUseBlockTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaAPIErrorTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolUseBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaAPIErrorTypeNullable.g.cs similarity index 77% rename from src/libs/Anthropic/Generated/JsonConverters.ToolUseBlockTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaAPIErrorTypeNullable.g.cs index 971366e..b75cc02 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ToolUseBlockTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaAPIErrorTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ToolUseBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaAPIErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ToolUseBlockType? Read( + public override global::Anthropic.BetaAPIErrorType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ToolUseBlockTypeNullableJsonConverter : global::System.Text. var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ToolUseBlockTypeExtensions.ToEnum(stringValue); + return global::Anthropic.BetaAPIErrorTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class ToolUseBlockTypeNullableJsonConverter : global::System.Text. case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ToolUseBlockType)numValue; + return (global::Anthropic.BetaAPIErrorType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class ToolUseBlockTypeNullableJsonConverter : global::System.Text. /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ToolUseBlockType? value, + global::Anthropic.BetaAPIErrorType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.ToolUseBlockTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaAPIErrorTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaAuthenticationErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaAuthenticationErrorType.g.cs new file mode 100644 index 0000000..d629905 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaAuthenticationErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaAuthenticationErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaAuthenticationErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaAuthenticationErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaAuthenticationErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaAuthenticationErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaAuthenticationErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaAuthenticationErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaAuthenticationErrorTypeNullable.g.cs new file mode 100644 index 0000000..ca47f5d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaAuthenticationErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaAuthenticationErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaAuthenticationErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaAuthenticationErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaAuthenticationErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaAuthenticationErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaAuthenticationErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceMediaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceMediaType.g.cs new file mode 100644 index 0000000..8dbb8e6 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceMediaType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBase64ImageSourceMediaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBase64ImageSourceMediaType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBase64ImageSourceMediaTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBase64ImageSourceMediaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBase64ImageSourceMediaType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaBase64ImageSourceMediaTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceMediaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceMediaTypeNullable.g.cs new file mode 100644 index 0000000..e7a831a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceMediaTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBase64ImageSourceMediaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBase64ImageSourceMediaType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBase64ImageSourceMediaTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBase64ImageSourceMediaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBase64ImageSourceMediaType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaBase64ImageSourceMediaTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceMediaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceType.g.cs similarity index 71% rename from src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceMediaType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceType.g.cs index dd7f608..432050f 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceMediaType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ImageBlockSourceMediaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaBase64ImageSourceTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ImageBlockSourceMediaType Read( + public override global::Anthropic.BetaBase64ImageSourceType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ImageBlockSourceMediaTypeJsonConverter : global::System.Text var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ImageBlockSourceMediaTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaBase64ImageSourceTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class ImageBlockSourceMediaTypeJsonConverter : global::System.Text case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ImageBlockSourceMediaType)numValue; + return (global::Anthropic.BetaBase64ImageSourceType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class ImageBlockSourceMediaTypeJsonConverter : global::System.Text /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ImageBlockSourceMediaType value, + global::Anthropic.BetaBase64ImageSourceType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.ImageBlockSourceMediaTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaBase64ImageSourceTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceMediaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceTypeNullable.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceMediaTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceTypeNullable.g.cs index b24fce2..47b9b2c 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceMediaTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64ImageSourceTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ImageBlockSourceMediaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaBase64ImageSourceTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ImageBlockSourceMediaType? Read( + public override global::Anthropic.BetaBase64ImageSourceType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ImageBlockSourceMediaTypeNullableJsonConverter : global::Sys var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ImageBlockSourceMediaTypeExtensions.ToEnum(stringValue); + return global::Anthropic.BetaBase64ImageSourceTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class ImageBlockSourceMediaTypeNullableJsonConverter : global::Sys case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ImageBlockSourceMediaType)numValue; + return (global::Anthropic.BetaBase64ImageSourceType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class ImageBlockSourceMediaTypeNullableJsonConverter : global::Sys /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ImageBlockSourceMediaType? value, + global::Anthropic.BetaBase64ImageSourceType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.ImageBlockSourceMediaTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaBase64ImageSourceTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchProcessingStatus.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceMediaType.g.cs similarity index 70% rename from src/libs/Anthropic/Generated/JsonConverters.MessageBatchProcessingStatus.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceMediaType.g.cs index b3ef467..38290a8 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchProcessingStatus.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceMediaType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class MessageBatchProcessingStatusJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaBase64PDFSourceMediaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.MessageBatchProcessingStatus Read( + public override global::Anthropic.BetaBase64PDFSourceMediaType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class MessageBatchProcessingStatusJsonConverter : global::System.T var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.MessageBatchProcessingStatusExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaBase64PDFSourceMediaTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class MessageBatchProcessingStatusJsonConverter : global::System.T case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.MessageBatchProcessingStatus)numValue; + return (global::Anthropic.BetaBase64PDFSourceMediaType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class MessageBatchProcessingStatusJsonConverter : global::System.T /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.MessageBatchProcessingStatus value, + global::Anthropic.BetaBase64PDFSourceMediaType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.MessageBatchProcessingStatusExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaBase64PDFSourceMediaTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchProcessingStatusNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceMediaTypeNullable.g.cs similarity index 72% rename from src/libs/Anthropic/Generated/JsonConverters.MessageBatchProcessingStatusNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceMediaTypeNullable.g.cs index 8a57d22..280e5a2 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchProcessingStatusNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceMediaTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class MessageBatchProcessingStatusNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaBase64PDFSourceMediaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.MessageBatchProcessingStatus? Read( + public override global::Anthropic.BetaBase64PDFSourceMediaType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class MessageBatchProcessingStatusNullableJsonConverter : global:: var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.MessageBatchProcessingStatusExtensions.ToEnum(stringValue); + return global::Anthropic.BetaBase64PDFSourceMediaTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class MessageBatchProcessingStatusNullableJsonConverter : global:: case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.MessageBatchProcessingStatus)numValue; + return (global::Anthropic.BetaBase64PDFSourceMediaType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class MessageBatchProcessingStatusNullableJsonConverter : global:: /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.MessageBatchProcessingStatus? value, + global::Anthropic.BetaBase64PDFSourceMediaType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.MessageBatchProcessingStatusExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaBase64PDFSourceMediaTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceType.g.cs new file mode 100644 index 0000000..7eff14f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBase64PDFSourceTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBase64PDFSourceType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBase64PDFSourceTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBase64PDFSourceType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBase64PDFSourceType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaBase64PDFSourceTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceTypeNullable.g.cs new file mode 100644 index 0000000..b130246 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBase64PDFSourceTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBase64PDFSourceTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBase64PDFSourceType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBase64PDFSourceTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBase64PDFSourceType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBase64PDFSourceType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaBase64PDFSourceTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022CacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022CacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..4bdcc12 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022CacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBashTool20241022CacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022CacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022CacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..0998e15 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022CacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBashTool20241022CacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022Name.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022Name.g.cs new file mode 100644 index 0000000..f1e0f31 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022Name.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBashTool20241022NameJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBashTool20241022Name Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBashTool20241022NameExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBashTool20241022Name)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBashTool20241022Name value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaBashTool20241022NameExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022NameNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022NameNullable.g.cs new file mode 100644 index 0000000..9bcd159 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022NameNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBashTool20241022NameNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBashTool20241022Name? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBashTool20241022NameExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBashTool20241022Name)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBashTool20241022Name? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaBashTool20241022NameExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022Type.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022Type.g.cs new file mode 100644 index 0000000..587ea80 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022Type.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBashTool20241022TypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBashTool20241022Type Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBashTool20241022TypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBashTool20241022Type)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBashTool20241022Type value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaBashTool20241022TypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022TypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022TypeNullable.g.cs new file mode 100644 index 0000000..dd20ef8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaBashTool20241022TypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaBashTool20241022TypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaBashTool20241022Type? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaBashTool20241022TypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaBashTool20241022Type)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaBashTool20241022Type? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaBashTool20241022TypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaCacheControlEphemeralType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCacheControlEphemeralType.g.cs new file mode 100644 index 0000000..96f4270 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCacheControlEphemeralType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaCacheControlEphemeralTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaCacheControlEphemeralType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaCacheControlEphemeralTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaCacheControlEphemeralType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaCacheControlEphemeralType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaCacheControlEphemeralTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaCacheControlEphemeralTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCacheControlEphemeralTypeNullable.g.cs new file mode 100644 index 0000000..d4303c4 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCacheControlEphemeralTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaCacheControlEphemeralTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaCacheControlEphemeralType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaCacheControlEphemeralTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaCacheControlEphemeralType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaCacheControlEphemeralType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaCacheControlEphemeralTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCanceledResultType.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.BlockDiscriminatorType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaCanceledResultType.g.cs index 6ec0c6b..f486bb3 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.BlockDiscriminatorType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCanceledResultType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class BlockDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaCanceledResultTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.BlockDiscriminatorType Read( + public override global::Anthropic.BetaCanceledResultType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class BlockDiscriminatorTypeJsonConverter : global::System.Text.Js var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.BlockDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaCanceledResultTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class BlockDiscriminatorTypeJsonConverter : global::System.Text.Js case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.BlockDiscriminatorType)numValue; + return (global::Anthropic.BetaCanceledResultType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class BlockDiscriminatorTypeJsonConverter : global::System.Text.Js /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.BlockDiscriminatorType value, + global::Anthropic.BetaCanceledResultType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.BlockDiscriminatorTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaCanceledResultTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BlockDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCanceledResultTypeNullable.g.cs similarity index 74% rename from src/libs/Anthropic/Generated/JsonConverters.BlockDiscriminatorTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaCanceledResultTypeNullable.g.cs index 34e96fd..36e2055 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.BlockDiscriminatorTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCanceledResultTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class BlockDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaCanceledResultTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.BlockDiscriminatorType? Read( + public override global::Anthropic.BetaCanceledResultType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class BlockDiscriminatorTypeNullableJsonConverter : global::System var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.BlockDiscriminatorTypeExtensions.ToEnum(stringValue); + return global::Anthropic.BetaCanceledResultTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class BlockDiscriminatorTypeNullableJsonConverter : global::System case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.BlockDiscriminatorType)numValue; + return (global::Anthropic.BetaCanceledResultType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class BlockDiscriminatorTypeNullableJsonConverter : global::System /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.BlockDiscriminatorType? value, + global::Anthropic.BetaCanceledResultType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.BlockDiscriminatorTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaCanceledResultTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..794e89c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaComputerUseTool20241022CacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..507058b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaComputerUseTool20241022CacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022Name.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022Name.g.cs new file mode 100644 index 0000000..635f6b3 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022Name.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaComputerUseTool20241022NameJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaComputerUseTool20241022Name Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaComputerUseTool20241022NameExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaComputerUseTool20241022Name)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaComputerUseTool20241022Name value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaComputerUseTool20241022NameExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022NameNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022NameNullable.g.cs new file mode 100644 index 0000000..4f6e81f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022NameNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaComputerUseTool20241022NameNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaComputerUseTool20241022Name? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaComputerUseTool20241022NameExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaComputerUseTool20241022Name)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaComputerUseTool20241022Name? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaComputerUseTool20241022NameExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022Type.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022Type.g.cs new file mode 100644 index 0000000..af4d926 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022Type.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaComputerUseTool20241022TypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaComputerUseTool20241022Type Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaComputerUseTool20241022TypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaComputerUseTool20241022Type)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaComputerUseTool20241022Type value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaComputerUseTool20241022TypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022TypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022TypeNullable.g.cs new file mode 100644 index 0000000..05901f9 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaComputerUseTool20241022TypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaComputerUseTool20241022TypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaComputerUseTool20241022Type? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaComputerUseTool20241022TypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaComputerUseTool20241022Type)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaComputerUseTool20241022Type? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaComputerUseTool20241022TypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlock.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlock.g.cs new file mode 100644 index 0000000..359a4e9 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlock.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class BetaContentBlockJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlock Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaContentBlockDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaResponseTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.BetaContentBlockDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaResponseTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaResponseToolUseBlock? toolUse = default; + if (discriminator?.Type == global::Anthropic.BetaContentBlockDiscriminatorType.ToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaResponseToolUseBlock)}"); + toolUse = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.BetaContentBlock( + discriminator?.Type, + text, + toolUse + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlock value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaResponseTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaResponseToolUseBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolUse, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorType.g.cs new file mode 100644 index 0000000..ebec803 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockDeltaEventDeltaDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..d68196b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockDeltaEventDeltaDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventType.g.cs new file mode 100644 index 0000000..72e1a7f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockDeltaEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockDeltaEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockDeltaEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockDeltaEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockDeltaEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaContentBlockDeltaEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventTypeNullable.g.cs new file mode 100644 index 0000000..cc03b0f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDeltaEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockDeltaEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockDeltaEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockDeltaEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockDeltaEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockDeltaEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaContentBlockDeltaEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..87a24b8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaContentBlockDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..534c320 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaContentBlockDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..b38f203 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockStartEventContentBlockDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..94d5b93 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockStartEventContentBlockDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventType.g.cs new file mode 100644 index 0000000..789ac09 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockStartEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockStartEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockStartEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockStartEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaContentBlockStartEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventTypeNullable.g.cs new file mode 100644 index 0000000..5252921 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStartEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockStartEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockStartEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockStartEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockStartEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaContentBlockStartEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStopEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStopEventType.g.cs new file mode 100644 index 0000000..7ee2f3a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStopEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockStopEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockStopEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockStopEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockStopEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaContentBlockStopEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStopEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStopEventTypeNullable.g.cs new file mode 100644 index 0000000..39dbd11 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaContentBlockStopEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaContentBlockStopEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaContentBlockStopEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaContentBlockStopEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaContentBlockStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaContentBlockStopEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaContentBlockStopEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorType.g.cs new file mode 100644 index 0000000..4af1bda --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaCountMessageTokensParamsToolDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..3769c45 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaCountMessageTokensParamsToolDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaCreateMessageParamsToolDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCreateMessageParamsToolDiscriminatorType.g.cs new file mode 100644 index 0000000..14fcd5e --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCreateMessageParamsToolDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaCreateMessageParamsToolDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaCreateMessageParamsToolDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaCreateMessageParamsToolDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaCreateMessageParamsToolDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaCreateMessageParamsToolDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..eb66918 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaCreateMessageParamsToolDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaCreateMessageParamsToolDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaCreateMessageParamsToolDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaCreateMessageParamsToolDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseErrorDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseErrorDiscriminatorType.g.cs new file mode 100644 index 0000000..67726ec --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseErrorDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaErrorResponseErrorDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaErrorResponseErrorDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaErrorResponseErrorDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaErrorResponseErrorDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaErrorResponseErrorDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaErrorResponseErrorDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseErrorDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseErrorDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..f89d9c5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseErrorDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaErrorResponseErrorDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaErrorResponseErrorDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaErrorResponseErrorDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaErrorResponseErrorDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaErrorResponseErrorDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaErrorResponseErrorDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseType.g.cs new file mode 100644 index 0000000..73d47db --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaErrorResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaErrorResponseType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaErrorResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaErrorResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaErrorResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaErrorResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseTypeNullable.g.cs new file mode 100644 index 0000000..f22cb16 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaErrorResponseTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaErrorResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaErrorResponseType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaErrorResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaErrorResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaErrorResponseType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaErrorResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaErroredResultType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaErroredResultType.g.cs new file mode 100644 index 0000000..31a56ba --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaErroredResultType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaErroredResultTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaErroredResultType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaErroredResultTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaErroredResultType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaErroredResultType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaErroredResultTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaErroredResultTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaErroredResultTypeNullable.g.cs new file mode 100644 index 0000000..58047a8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaErroredResultTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaErroredResultTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaErroredResultType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaErroredResultTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaErroredResultType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaErroredResultType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaErroredResultTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaExpiredResultType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaExpiredResultType.g.cs new file mode 100644 index 0000000..c5f8095 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaExpiredResultType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaExpiredResultTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaExpiredResultType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaExpiredResultTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaExpiredResultType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaExpiredResultType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaExpiredResultTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaExpiredResultTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaExpiredResultTypeNullable.g.cs new file mode 100644 index 0000000..1968a64 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaExpiredResultTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaExpiredResultTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaExpiredResultType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaExpiredResultTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaExpiredResultType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaExpiredResultType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaExpiredResultTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlock.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlock.g.cs new file mode 100644 index 0000000..150c297 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlock.g.cs @@ -0,0 +1,113 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class BetaInputContentBlockJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInputContentBlock Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaInputContentBlockDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaInputContentBlockDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaRequestTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.BetaInputContentBlockDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaRequestImageBlock? image = default; + if (discriminator?.Type == global::Anthropic.BetaInputContentBlockDiscriminatorType.Image) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestImageBlock)}"); + image = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaRequestToolUseBlock? toolUse = default; + if (discriminator?.Type == global::Anthropic.BetaInputContentBlockDiscriminatorType.ToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestToolUseBlock)}"); + toolUse = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaRequestToolResultBlock? toolResult = default; + if (discriminator?.Type == global::Anthropic.BetaInputContentBlockDiscriminatorType.ToolResult) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestToolResultBlock)}"); + toolResult = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaRequestPDFBlock? document = default; + if (discriminator?.Type == global::Anthropic.BetaInputContentBlockDiscriminatorType.Document) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestPDFBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestPDFBlock)}"); + document = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.BetaInputContentBlock( + discriminator?.Type, + text, + image, + toolUse, + toolResult, + document + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInputContentBlock value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRequestTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsImage) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRequestImageBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Image, typeInfo); + } + else if (value.IsToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRequestToolUseBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolUse, typeInfo); + } + else if (value.IsToolResult) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRequestToolResultBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolResult, typeInfo); + } + else if (value.IsDocument) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestPDFBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRequestPDFBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Document, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..2fdc23e --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlockDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInputContentBlockDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInputContentBlockDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInputContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInputContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInputContentBlockDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaInputContentBlockDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlockDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlockDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..ac8404d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputContentBlockDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInputContentBlockDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInputContentBlockDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInputContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInputContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInputContentBlockDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaInputContentBlockDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInputJsonContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputJsonContentBlockDeltaType.g.cs new file mode 100644 index 0000000..9c68791 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputJsonContentBlockDeltaType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInputJsonContentBlockDeltaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInputJsonContentBlockDeltaType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInputJsonContentBlockDeltaTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInputJsonContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInputJsonContentBlockDeltaType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaInputJsonContentBlockDeltaTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInputJsonContentBlockDeltaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputJsonContentBlockDeltaTypeNullable.g.cs new file mode 100644 index 0000000..99bcd5b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputJsonContentBlockDeltaTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInputJsonContentBlockDeltaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInputJsonContentBlockDeltaType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInputJsonContentBlockDeltaTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInputJsonContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInputJsonContentBlockDeltaType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaInputJsonContentBlockDeltaTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInputMessageRole.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputMessageRole.g.cs new file mode 100644 index 0000000..bfe4f54 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputMessageRole.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInputMessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInputMessageRole Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInputMessageRoleExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInputMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInputMessageRole value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaInputMessageRoleExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInputMessageRoleNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputMessageRoleNullable.g.cs new file mode 100644 index 0000000..38e48e8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputMessageRoleNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInputMessageRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInputMessageRole? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInputMessageRoleExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInputMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInputMessageRole? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaInputMessageRoleExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolResultBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputSchemaType.g.cs similarity index 76% rename from src/libs/Anthropic/Generated/JsonConverters.ToolResultBlockType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaInputSchemaType.g.cs index 0817cf1..98a3800 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ToolResultBlockType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputSchemaType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ToolResultBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaInputSchemaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ToolResultBlockType Read( + public override global::Anthropic.BetaInputSchemaType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ToolResultBlockTypeJsonConverter : global::System.Text.Json. var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ToolResultBlockTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaInputSchemaTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class ToolResultBlockTypeJsonConverter : global::System.Text.Json. case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ToolResultBlockType)numValue; + return (global::Anthropic.BetaInputSchemaType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class ToolResultBlockTypeJsonConverter : global::System.Text.Json. /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ToolResultBlockType value, + global::Anthropic.BetaInputSchemaType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.ToolResultBlockTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaInputSchemaTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolResultBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInputSchemaTypeNullable.g.cs similarity index 77% rename from src/libs/Anthropic/Generated/JsonConverters.ToolResultBlockTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaInputSchemaTypeNullable.g.cs index a9420a8..8383164 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ToolResultBlockTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInputSchemaTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ToolResultBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaInputSchemaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ToolResultBlockType? Read( + public override global::Anthropic.BetaInputSchemaType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ToolResultBlockTypeNullableJsonConverter : global::System.Te var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ToolResultBlockTypeExtensions.ToEnum(stringValue); + return global::Anthropic.BetaInputSchemaTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class ToolResultBlockTypeNullableJsonConverter : global::System.Te case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ToolResultBlockType)numValue; + return (global::Anthropic.BetaInputSchemaType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class ToolResultBlockTypeNullableJsonConverter : global::System.Te /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ToolResultBlockType? value, + global::Anthropic.BetaInputSchemaType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.ToolResultBlockTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaInputSchemaTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInvalidRequestErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInvalidRequestErrorType.g.cs new file mode 100644 index 0000000..8773fe5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInvalidRequestErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInvalidRequestErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInvalidRequestErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInvalidRequestErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInvalidRequestErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInvalidRequestErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaInvalidRequestErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaInvalidRequestErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaInvalidRequestErrorTypeNullable.g.cs new file mode 100644 index 0000000..c74c2d4 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaInvalidRequestErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaInvalidRequestErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaInvalidRequestErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaInvalidRequestErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaInvalidRequestErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaInvalidRequestErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaInvalidRequestErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchProcessingStatus.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchProcessingStatus.g.cs new file mode 100644 index 0000000..f3f4e82 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchProcessingStatus.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageBatchProcessingStatusJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageBatchProcessingStatus Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageBatchProcessingStatusExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageBatchProcessingStatus)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageBatchProcessingStatus value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageBatchProcessingStatusExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchProcessingStatusNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchProcessingStatusNullable.g.cs new file mode 100644 index 0000000..69667df --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchProcessingStatusNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageBatchProcessingStatusNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageBatchProcessingStatus? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageBatchProcessingStatusExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageBatchProcessingStatus)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageBatchProcessingStatus? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageBatchProcessingStatusExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResult.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResult.g.cs new file mode 100644 index 0000000..4c3aadf --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResult.g.cs @@ -0,0 +1,99 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class BetaMessageBatchResultJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageBatchResult Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageBatchResultDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaMessageBatchResultDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaSucceededResult? succeeded = default; + if (discriminator?.Type == global::Anthropic.BetaMessageBatchResultDiscriminatorType.Succeeded) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaSucceededResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaSucceededResult)}"); + succeeded = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaErroredResult? errored = default; + if (discriminator?.Type == global::Anthropic.BetaMessageBatchResultDiscriminatorType.Errored) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaErroredResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaErroredResult)}"); + errored = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaCanceledResult? canceled = default; + if (discriminator?.Type == global::Anthropic.BetaMessageBatchResultDiscriminatorType.Canceled) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaCanceledResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaCanceledResult)}"); + canceled = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaExpiredResult? expired = default; + if (discriminator?.Type == global::Anthropic.BetaMessageBatchResultDiscriminatorType.Expired) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaExpiredResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaExpiredResult)}"); + expired = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.BetaMessageBatchResult( + discriminator?.Type, + succeeded, + errored, + canceled, + expired + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageBatchResult value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsSucceeded) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaSucceededResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaSucceededResult).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Succeeded, typeInfo); + } + else if (value.IsErrored) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaErroredResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaErroredResult).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Errored, typeInfo); + } + else if (value.IsCanceled) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaCanceledResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaCanceledResult).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Canceled, typeInfo); + } + else if (value.IsExpired) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaExpiredResult), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaExpiredResult).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Expired, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResultDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResultDiscriminatorType.g.cs new file mode 100644 index 0000000..cef2cd6 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResultDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageBatchResultDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageBatchResultDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageBatchResultDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageBatchResultDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageBatchResultDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageBatchResultDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResultDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResultDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..e65cf98 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchResultDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageBatchResultDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageBatchResultDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageBatchResultDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageBatchResultDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageBatchResultDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageBatchResultDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchType.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchType.g.cs index acead7c..0686d5a 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ImageBlockSourceTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaMessageBatchTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ImageBlockSourceType Read( + public override global::Anthropic.BetaMessageBatchType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ImageBlockSourceTypeJsonConverter : global::System.Text.Json var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ImageBlockSourceTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaMessageBatchTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class ImageBlockSourceTypeJsonConverter : global::System.Text.Json case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ImageBlockSourceType)numValue; + return (global::Anthropic.BetaMessageBatchType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class ImageBlockSourceTypeJsonConverter : global::System.Text.Json /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ImageBlockSourceType value, + global::Anthropic.BetaMessageBatchType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.ImageBlockSourceTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaMessageBatchTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchTypeNullable.g.cs similarity index 75% rename from src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchTypeNullable.g.cs index 17901e6..e0c5c9e 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockSourceTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageBatchTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ImageBlockSourceTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaMessageBatchTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ImageBlockSourceType? Read( + public override global::Anthropic.BetaMessageBatchType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ImageBlockSourceTypeNullableJsonConverter : global::System.T var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ImageBlockSourceTypeExtensions.ToEnum(stringValue); + return global::Anthropic.BetaMessageBatchTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class ImageBlockSourceTypeNullableJsonConverter : global::System.T case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ImageBlockSourceType)numValue; + return (global::Anthropic.BetaMessageBatchType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class ImageBlockSourceTypeNullableJsonConverter : global::System.T /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ImageBlockSourceType? value, + global::Anthropic.BetaMessageBatchType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.ImageBlockSourceTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaMessageBatchTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.CreateMessageRequestModel.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaEventType.g.cs similarity index 71% rename from src/libs/Anthropic/Generated/JsonConverters.CreateMessageRequestModel.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaEventType.g.cs index 3c2b095..fb0b842 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.CreateMessageRequestModel.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaEventType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class CreateMessageRequestModelJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaMessageDeltaEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.CreateMessageRequestModel Read( + public override global::Anthropic.BetaMessageDeltaEventType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class CreateMessageRequestModelJsonConverter : global::System.Text var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.CreateMessageRequestModelExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaMessageDeltaEventTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class CreateMessageRequestModelJsonConverter : global::System.Text case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.CreateMessageRequestModel)numValue; + return (global::Anthropic.BetaMessageDeltaEventType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class CreateMessageRequestModelJsonConverter : global::System.Text /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.CreateMessageRequestModel value, + global::Anthropic.BetaMessageDeltaEventType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.CreateMessageRequestModelExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaMessageDeltaEventTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.CreateMessageRequestModelNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaEventTypeNullable.g.cs similarity index 72% rename from src/libs/Anthropic/Generated/JsonConverters.CreateMessageRequestModelNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaEventTypeNullable.g.cs index dc56da1..450781c 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.CreateMessageRequestModelNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaEventTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class CreateMessageRequestModelNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaMessageDeltaEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.CreateMessageRequestModel? Read( + public override global::Anthropic.BetaMessageDeltaEventType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class CreateMessageRequestModelNullableJsonConverter : global::Sys var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.CreateMessageRequestModelExtensions.ToEnum(stringValue); + return global::Anthropic.BetaMessageDeltaEventTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class CreateMessageRequestModelNullableJsonConverter : global::Sys case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.CreateMessageRequestModel)numValue; + return (global::Anthropic.BetaMessageDeltaEventType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class CreateMessageRequestModelNullableJsonConverter : global::Sys /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.CreateMessageRequestModel? value, + global::Anthropic.BetaMessageDeltaEventType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.CreateMessageRequestModelExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaMessageDeltaEventTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaStopReason.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaStopReason.g.cs new file mode 100644 index 0000000..ff1a156 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaStopReason.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageDeltaStopReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageDeltaStopReason Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageDeltaStopReasonExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageDeltaStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageDeltaStopReason value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageDeltaStopReasonExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaStopReasonNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaStopReasonNullable.g.cs new file mode 100644 index 0000000..335e557 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageDeltaStopReasonNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageDeltaStopReasonNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageDeltaStopReason? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageDeltaStopReasonExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageDeltaStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageDeltaStopReason? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageDeltaStopReasonExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageRole.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageRole.g.cs new file mode 100644 index 0000000..14a37e5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageRole.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageRole Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageRoleExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageRole value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageRoleExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageRoleNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageRoleNullable.g.cs new file mode 100644 index 0000000..59409ce --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageRoleNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageRole? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageRoleExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageRole? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageRoleExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStartEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStartEventType.g.cs new file mode 100644 index 0000000..2302311 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStartEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStartEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStartEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStartEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStartEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageStartEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStartEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStartEventTypeNullable.g.cs new file mode 100644 index 0000000..6d9869f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStartEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStartEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStartEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStartEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStartEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageStartEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopEventType.g.cs new file mode 100644 index 0000000..20d6626 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStopEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStopEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStopEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStopEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageStopEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopEventTypeNullable.g.cs new file mode 100644 index 0000000..75b605f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStopEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStopEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStopEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStopEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageStopEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopReason.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopReason.g.cs new file mode 100644 index 0000000..f18850b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopReason.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStopReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStopReason Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStopReasonExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStopReason value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageStopReasonExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopReasonNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopReasonNullable.g.cs new file mode 100644 index 0000000..6d6dbff --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStopReasonNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStopReasonNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStopReason? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStopReasonExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStopReason? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageStopReasonExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEvent.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEvent.g.cs new file mode 100644 index 0000000..01e9ac2 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEvent.g.cs @@ -0,0 +1,127 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class BetaMessageStreamEventJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStreamEvent Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageStreamEventDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaMessageStreamEventDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaMessageStartEvent? messageStart = default; + if (discriminator?.Type == global::Anthropic.BetaMessageStreamEventDiscriminatorType.MessageStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaMessageStartEvent)}"); + messageStart = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaMessageDeltaEvent? messageDelta = default; + if (discriminator?.Type == global::Anthropic.BetaMessageStreamEventDiscriminatorType.MessageDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaMessageDeltaEvent)}"); + messageDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaMessageStopEvent? messageStop = default; + if (discriminator?.Type == global::Anthropic.BetaMessageStreamEventDiscriminatorType.MessageStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaMessageStopEvent)}"); + messageStop = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaContentBlockStartEvent? contentBlockStart = default; + if (discriminator?.Type == global::Anthropic.BetaMessageStreamEventDiscriminatorType.ContentBlockStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaContentBlockStartEvent)}"); + contentBlockStart = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaContentBlockDeltaEvent? contentBlockDelta = default; + if (discriminator?.Type == global::Anthropic.BetaMessageStreamEventDiscriminatorType.ContentBlockDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaContentBlockDeltaEvent)}"); + contentBlockDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaContentBlockStopEvent? contentBlockStop = default; + if (discriminator?.Type == global::Anthropic.BetaMessageStreamEventDiscriminatorType.ContentBlockStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaContentBlockStopEvent)}"); + contentBlockStop = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.BetaMessageStreamEvent( + discriminator?.Type, + messageStart, + messageDelta, + messageStop, + contentBlockStart, + contentBlockDelta, + contentBlockStop + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStreamEvent value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsMessageStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaMessageStartEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageStart, typeInfo); + } + else if (value.IsMessageDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaMessageDeltaEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageDelta, typeInfo); + } + else if (value.IsMessageStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaMessageStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaMessageStopEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageStop, typeInfo); + } + else if (value.IsContentBlockStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaContentBlockStartEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ContentBlockStart, typeInfo); + } + else if (value.IsContentBlockDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaContentBlockDeltaEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ContentBlockDelta, typeInfo); + } + else if (value.IsContentBlockStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaContentBlockStopEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ContentBlockStop, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEventDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEventDiscriminatorType.g.cs new file mode 100644 index 0000000..c1f5c75 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEventDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStreamEventDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStreamEventDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStreamEventDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStreamEventDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStreamEventDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageStreamEventDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEventDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEventDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..afd4920 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageStreamEventDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageStreamEventDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageStreamEventDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageStreamEventDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageStreamEventDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageStreamEventDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageStreamEventDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageType.g.cs new file mode 100644 index 0000000..6314253 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaMessageTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaMessageTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageTypeNullable.g.cs new file mode 100644 index 0000000..cdb5a2d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaMessageTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaMessageTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaMessageType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaMessageTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaMessageType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaMessageType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaMessageTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaNotFoundErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaNotFoundErrorType.g.cs new file mode 100644 index 0000000..d977195 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaNotFoundErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaNotFoundErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaNotFoundErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaNotFoundErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaNotFoundErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaNotFoundErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaNotFoundErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaNotFoundErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaNotFoundErrorTypeNullable.g.cs new file mode 100644 index 0000000..e40b892 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaNotFoundErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaNotFoundErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaNotFoundErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaNotFoundErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaNotFoundErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaNotFoundErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaNotFoundErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaOverloadedErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaOverloadedErrorType.g.cs new file mode 100644 index 0000000..3dd388c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaOverloadedErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaOverloadedErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaOverloadedErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaOverloadedErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaOverloadedErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaOverloadedErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaOverloadedErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaOverloadedErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaOverloadedErrorTypeNullable.g.cs new file mode 100644 index 0000000..0d1e724 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaOverloadedErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaOverloadedErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaOverloadedErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaOverloadedErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaOverloadedErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaOverloadedErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaOverloadedErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaPermissionErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaPermissionErrorType.g.cs new file mode 100644 index 0000000..aa7f1d3 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaPermissionErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaPermissionErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaPermissionErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaPermissionErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaPermissionErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaPermissionErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaPermissionErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaPermissionErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaPermissionErrorTypeNullable.g.cs new file mode 100644 index 0000000..2f98701 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaPermissionErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaPermissionErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaPermissionErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaPermissionErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaPermissionErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaPermissionErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaPermissionErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRateLimitErrorType.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.MessageStreamEventType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaRateLimitErrorType.g.cs index 9ee308e..0d903f1 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEventType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRateLimitErrorType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class MessageStreamEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaRateLimitErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.MessageStreamEventType Read( + public override global::Anthropic.BetaRateLimitErrorType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class MessageStreamEventTypeJsonConverter : global::System.Text.Js var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.MessageStreamEventTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaRateLimitErrorTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class MessageStreamEventTypeJsonConverter : global::System.Text.Js case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.MessageStreamEventType)numValue; + return (global::Anthropic.BetaRateLimitErrorType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class MessageStreamEventTypeJsonConverter : global::System.Text.Js /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.MessageStreamEventType value, + global::Anthropic.BetaRateLimitErrorType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.MessageStreamEventTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaRateLimitErrorTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRateLimitErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRateLimitErrorTypeNullable.g.cs new file mode 100644 index 0000000..5302953 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRateLimitErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRateLimitErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRateLimitErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRateLimitErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRateLimitErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRateLimitErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRateLimitErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..0a79613 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestImageBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..ab18f7b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestImageBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockSourceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockSourceDiscriminatorType.g.cs new file mode 100644 index 0000000..719c164 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockSourceDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestImageBlockSourceDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockSourceDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockSourceDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..6d437c5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockSourceDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestImageBlockSourceDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockType.g.cs new file mode 100644 index 0000000..4e0c46f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestImageBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestImageBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestImageBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestImageBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestImageBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestImageBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockTypeNullable.g.cs new file mode 100644 index 0000000..8c9bae6 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestImageBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestImageBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestImageBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestImageBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestImageBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestImageBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestImageBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..2d7ec2f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestPDFBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..eec5938 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestPDFBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockType.g.cs new file mode 100644 index 0000000..25fea1e --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestPDFBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestPDFBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestPDFBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestPDFBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestPDFBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestPDFBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockTypeNullable.g.cs new file mode 100644 index 0000000..83093ba --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestPDFBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestPDFBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestPDFBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestPDFBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestPDFBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestPDFBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestPDFBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..1a64ab8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestTextBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..3692b15 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestTextBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockType.g.cs new file mode 100644 index 0000000..413c82a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestTextBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestTextBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestTextBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestTextBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestTextBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockTypeNullable.g.cs new file mode 100644 index 0000000..63bde7f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestTextBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestTextBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestTextBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestTextBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestTextBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestTextBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..bc07834 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolResultBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..0f7a3bc --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolResultBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..8fb631b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..b27771b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockType.g.cs new file mode 100644 index 0000000..fd37edb --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolResultBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolResultBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolResultBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolResultBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolResultBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestToolResultBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockTypeNullable.g.cs new file mode 100644 index 0000000..8f50413 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolResultBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolResultBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolResultBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolResultBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolResultBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolResultBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestToolResultBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..b9a22c5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolUseBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..4ec135b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolUseBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockType.g.cs new file mode 100644 index 0000000..5ffb5cd --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolUseBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolUseBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolUseBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolUseBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaRequestToolUseBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockTypeNullable.g.cs new file mode 100644 index 0000000..1cb018d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaRequestToolUseBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaRequestToolUseBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaRequestToolUseBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaRequestToolUseBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaRequestToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaRequestToolUseBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaRequestToolUseBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaResponseTextBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseTextBlockType.g.cs new file mode 100644 index 0000000..b8da4ee --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseTextBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaResponseTextBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaResponseTextBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaResponseTextBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaResponseTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaResponseTextBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaResponseTextBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaResponseTextBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseTextBlockTypeNullable.g.cs new file mode 100644 index 0000000..d9f85ad --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseTextBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaResponseTextBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaResponseTextBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaResponseTextBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaResponseTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaResponseTextBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaResponseTextBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaResponseToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseToolUseBlockType.g.cs new file mode 100644 index 0000000..958bf68 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseToolUseBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaResponseToolUseBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaResponseToolUseBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaResponseToolUseBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaResponseToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaResponseToolUseBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaResponseToolUseBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaResponseToolUseBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseToolUseBlockTypeNullable.g.cs new file mode 100644 index 0000000..f6bc21f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaResponseToolUseBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaResponseToolUseBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaResponseToolUseBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaResponseToolUseBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaResponseToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaResponseToolUseBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaResponseToolUseBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaSucceededResultType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaSucceededResultType.g.cs new file mode 100644 index 0000000..0fde102 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaSucceededResultType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaSucceededResultTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaSucceededResultType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaSucceededResultTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaSucceededResultType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaSucceededResultType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaSucceededResultTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaSucceededResultTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaSucceededResultTypeNullable.g.cs new file mode 100644 index 0000000..e322111 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaSucceededResultTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaSucceededResultTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaSucceededResultType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaSucceededResultTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaSucceededResultType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaSucceededResultType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaSucceededResultTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextContentBlockDeltaType.g.cs new file mode 100644 index 0000000..2b09262 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextContentBlockDeltaType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextContentBlockDeltaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextContentBlockDeltaType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextContentBlockDeltaTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextContentBlockDeltaType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaTextContentBlockDeltaTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextContentBlockDeltaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextContentBlockDeltaTypeNullable.g.cs new file mode 100644 index 0000000..a954318 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextContentBlockDeltaTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextContentBlockDeltaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextContentBlockDeltaType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextContentBlockDeltaTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextContentBlockDeltaType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaTextContentBlockDeltaTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..8e3e9d4 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextEditor20241022CacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..9113255 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextEditor20241022CacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022Name.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022Name.g.cs new file mode 100644 index 0000000..fedadc7 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022Name.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextEditor20241022NameJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextEditor20241022Name Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextEditor20241022NameExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextEditor20241022Name)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextEditor20241022Name value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaTextEditor20241022NameExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022NameNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022NameNullable.g.cs new file mode 100644 index 0000000..da2fa0e --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022NameNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextEditor20241022NameNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextEditor20241022Name? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextEditor20241022NameExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextEditor20241022Name)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextEditor20241022Name? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaTextEditor20241022NameExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022Type.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022Type.g.cs new file mode 100644 index 0000000..986973a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022Type.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextEditor20241022TypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextEditor20241022Type Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextEditor20241022TypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextEditor20241022Type)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextEditor20241022Type value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaTextEditor20241022TypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022TypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022TypeNullable.g.cs new file mode 100644 index 0000000..dea42a7 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaTextEditor20241022TypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaTextEditor20241022TypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaTextEditor20241022Type? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaTextEditor20241022TypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaTextEditor20241022Type)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaTextEditor20241022Type? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaTextEditor20241022TypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..92b9aea --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaToolCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..e919459 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaToolCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoice.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoice.g.cs new file mode 100644 index 0000000..a6aeb2e --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoice.g.cs @@ -0,0 +1,85 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class BetaToolChoiceJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoice Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaToolChoiceDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaToolChoiceDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaToolChoiceAuto? auto = default; + if (discriminator?.Type == global::Anthropic.BetaToolChoiceDiscriminatorType.Auto) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaToolChoiceAuto), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaToolChoiceAuto)}"); + auto = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaToolChoiceAny? any = default; + if (discriminator?.Type == global::Anthropic.BetaToolChoiceDiscriminatorType.Any) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaToolChoiceAny), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaToolChoiceAny)}"); + any = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaToolChoiceTool? tool = default; + if (discriminator?.Type == global::Anthropic.BetaToolChoiceDiscriminatorType.Tool) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaToolChoiceTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaToolChoiceTool)}"); + tool = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.BetaToolChoice( + discriminator?.Type, + auto, + any, + tool + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoice value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsAuto) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaToolChoiceAuto), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaToolChoiceAuto).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Auto, typeInfo); + } + else if (value.IsAny) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaToolChoiceAny), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaToolChoiceAny).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Any, typeInfo); + } + else if (value.IsTool) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaToolChoiceTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaToolChoiceTool).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Tool, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAnyType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAnyType.g.cs new file mode 100644 index 0000000..9b09861 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAnyType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceAnyTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceAnyType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceAnyTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceAnyType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceAnyType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaToolChoiceAnyTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAnyTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAnyTypeNullable.g.cs new file mode 100644 index 0000000..fe2fb84 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAnyTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceAnyTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceAnyType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceAnyTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceAnyType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceAnyType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaToolChoiceAnyTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAutoType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAutoType.g.cs new file mode 100644 index 0000000..c7d2d33 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAutoType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceAutoTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceAutoType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceAutoTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceAutoType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceAutoType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaToolChoiceAutoTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAutoTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAutoTypeNullable.g.cs new file mode 100644 index 0000000..af2f225 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceAutoTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceAutoTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceAutoType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceAutoTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceAutoType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceAutoType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaToolChoiceAutoTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceDiscriminatorType.g.cs new file mode 100644 index 0000000..30de7c7 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaToolChoiceDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..cbf381a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaToolChoiceDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceToolType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceToolType.g.cs new file mode 100644 index 0000000..30f06a5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceToolType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceToolTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceToolType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceToolTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceToolType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceToolType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.BetaToolChoiceToolTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceToolTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceToolTypeNullable.g.cs new file mode 100644 index 0000000..93b316b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolChoiceToolTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class BetaToolChoiceToolTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.BetaToolChoiceToolType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.BetaToolChoiceToolTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.BetaToolChoiceToolType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.BetaToolChoiceToolType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.BetaToolChoiceToolTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolType.g.cs similarity index 70% rename from src/libs/Anthropic/Generated/JsonConverters.ImageBlockType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaToolType.g.cs index 8882e32..4e7712b 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ImageBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaToolTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ImageBlockType Read( + public override global::Anthropic.BetaToolType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ImageBlockTypeJsonConverter : global::System.Text.Json.Seria var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ImageBlockTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.BetaToolTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class ImageBlockTypeJsonConverter : global::System.Text.Json.Seria case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ImageBlockType)numValue; + return (global::Anthropic.BetaToolType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class ImageBlockTypeJsonConverter : global::System.Text.Json.Seria /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ImageBlockType value, + global::Anthropic.BetaToolType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.ImageBlockTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.BetaToolTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.BetaToolTypeNullable.g.cs similarity index 72% rename from src/libs/Anthropic/Generated/JsonConverters.ImageBlockTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.BetaToolTypeNullable.g.cs index 74d8ae0..7bf97df 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ImageBlockTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.BetaToolTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ImageBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class BetaToolTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ImageBlockType? Read( + public override global::Anthropic.BetaToolType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ImageBlockTypeNullableJsonConverter : global::System.Text.Js var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ImageBlockTypeExtensions.ToEnum(stringValue); + return global::Anthropic.BetaToolTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class ImageBlockTypeNullableJsonConverter : global::System.Text.Js case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ImageBlockType)numValue; + return (global::Anthropic.BetaToolType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class ImageBlockTypeNullableJsonConverter : global::System.Text.Js /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ImageBlockType? value, + global::Anthropic.BetaToolType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.ImageBlockTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.BetaToolTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.CompletionResponseType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.CompletionResponseType.g.cs new file mode 100644 index 0000000..92e5cd9 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.CompletionResponseType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class CompletionResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.CompletionResponseType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.CompletionResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.CompletionResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.CompletionResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.CompletionResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.CompletionResponseTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.CompletionResponseTypeNullable.g.cs new file mode 100644 index 0000000..1c73bdd --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.CompletionResponseTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class CompletionResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.CompletionResponseType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.CompletionResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.CompletionResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.CompletionResponseType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.CompletionResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlock.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlock.g.cs new file mode 100644 index 0000000..15c4cd8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlock.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ContentBlockJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlock Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaResponseTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaResponseTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaResponseToolUseBlock? toolUse = default; + if (discriminator?.Type == global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType.ToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaResponseToolUseBlock)}"); + toolUse = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ContentBlock( + discriminator?.Type, + text, + toolUse + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlock value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaResponseTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaResponseToolUseBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolUse, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlock2.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlock2.g.cs new file mode 100644 index 0000000..f7555d1 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlock2.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ContentBlock2JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlock2 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStartEventContentBlockDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockStartEventContentBlockDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.ResponseTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ResponseTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.ResponseToolUseBlock? toolUse = default; + if (discriminator?.Type == global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType.ToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ResponseToolUseBlock)}"); + toolUse = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ContentBlock2( + discriminator?.Type, + text, + toolUse + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlock2 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ResponseTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ResponseToolUseBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolUse, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlock3.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlock3.g.cs new file mode 100644 index 0000000..fdedc7f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlock3.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ContentBlock3JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlock3 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.ResponseTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.ContentBlockDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ResponseTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.ResponseToolUseBlock? toolUse = default; + if (discriminator?.Type == global::Anthropic.ContentBlockDiscriminatorType.ToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ResponseToolUseBlock)}"); + toolUse = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ContentBlock3( + discriminator?.Type, + text, + toolUse + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlock3 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ResponseTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ResponseToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ResponseToolUseBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolUse, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorType.g.cs new file mode 100644 index 0000000..e82ee68 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockDeltaEventDeltaDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..8fb4670 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockDeltaEventDeltaDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventType.g.cs new file mode 100644 index 0000000..f8762ff --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockDeltaEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockDeltaEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockDeltaEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockDeltaEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockDeltaEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ContentBlockDeltaEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventTypeNullable.g.cs new file mode 100644 index 0000000..6557b41 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDeltaEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockDeltaEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockDeltaEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockDeltaEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockDeltaEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockDeltaEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ContentBlockDeltaEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..805fd02 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ContentBlockDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..0c33174 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ContentBlockDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventContentBlockDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventContentBlockDiscriminatorType.g.cs new file mode 100644 index 0000000..879581f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventContentBlockDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockStartEventContentBlockDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventContentBlockDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventContentBlockDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..736eb1a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventContentBlockDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockStartEventContentBlockDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventType.g.cs new file mode 100644 index 0000000..5b00a82 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockStartEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockStartEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockStartEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockStartEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ContentBlockStartEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventTypeNullable.g.cs new file mode 100644 index 0000000..6c74585 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStartEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockStartEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockStartEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockStartEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockStartEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ContentBlockStartEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStopEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStopEventType.g.cs new file mode 100644 index 0000000..49c0c3d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStopEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockStopEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockStopEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockStopEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockStopEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ContentBlockStopEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStopEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStopEventTypeNullable.g.cs new file mode 100644 index 0000000..d6a1347 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentBlockStopEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ContentBlockStopEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentBlockStopEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ContentBlockStopEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ContentBlockStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentBlockStopEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ContentBlockStopEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item.g.cs new file mode 100644 index 0000000..1cb20b8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ContentVariant2ItemJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentVariant2Item Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaRequestTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaRequestImageBlock? image = default; + if (discriminator?.Type == global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Image) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRequestImageBlock)}"); + image = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ContentVariant2Item( + discriminator?.Type, + text, + image + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentVariant2Item value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRequestTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsImage) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRequestImageBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Image, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.Block.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item2.g.cs similarity index 60% rename from src/libs/Anthropic/Generated/JsonConverters.Block.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item2.g.cs index ebc2ea2..962e789 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.Block.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item2.g.cs @@ -4,10 +4,10 @@ namespace Anthropic.JsonConverters { /// - public class BlockJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public class ContentVariant2Item2JsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.Block Read( + public override global::Anthropic.ContentVariant2Item2 Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -17,40 +17,40 @@ public class BlockJsonConverter : global::System.Text.Json.Serialization.JsonCon var readerCopy = reader; - var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BlockDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BlockDiscriminator)}"); + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.InputMessageContentVariant2ItemDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.InputMessageContentVariant2ItemDiscriminator)}"); var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); - global::Anthropic.TextBlock? text = default; - if (discriminator?.Type == global::Anthropic.BlockDiscriminatorType.Text) + global::Anthropic.RequestTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType.Text) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.TextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.TextBlock)}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RequestTextBlock)}"); text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - global::Anthropic.ImageBlock? image = default; - if (discriminator?.Type == global::Anthropic.BlockDiscriminatorType.Image) + global::Anthropic.RequestImageBlock? image = default; + if (discriminator?.Type == global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType.Image) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ImageBlock)}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RequestImageBlock)}"); image = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - global::Anthropic.ToolUseBlock? toolUse = default; - if (discriminator?.Type == global::Anthropic.BlockDiscriminatorType.ToolUse) + global::Anthropic.RequestToolUseBlock? toolUse = default; + if (discriminator?.Type == global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType.ToolUse) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ToolUseBlock)}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RequestToolUseBlock)}"); toolUse = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - global::Anthropic.ToolResultBlock? toolResult = default; - if (discriminator?.Type == global::Anthropic.BlockDiscriminatorType.ToolResult) + global::Anthropic.RequestToolResultBlock? toolResult = default; + if (discriminator?.Type == global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType.ToolResult) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ToolResultBlock)}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RequestToolResultBlock)}"); toolResult = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - var result = new global::Anthropic.Block( + var result = new global::Anthropic.ContentVariant2Item2( discriminator?.Type, text, image, @@ -64,7 +64,7 @@ public class BlockJsonConverter : global::System.Text.Json.Serialization.JsonCon /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.Block value, + global::Anthropic.ContentVariant2Item2 value, global::System.Text.Json.JsonSerializerOptions options) { options = options ?? throw new global::System.ArgumentNullException(nameof(options)); @@ -72,26 +72,26 @@ public override void Write( if (value.IsText) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.TextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.TextBlock).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.RequestTextBlock).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); } else if (value.IsImage) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ImageBlock).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.RequestImageBlock).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Image, typeInfo); } else if (value.IsToolUse) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolUseBlock).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.RequestToolUseBlock).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolUse, typeInfo); } else if (value.IsToolResult) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolResultBlock).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.RequestToolResultBlock).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolResult, typeInfo); } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item3.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item3.g.cs new file mode 100644 index 0000000..c7389c5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item3.g.cs @@ -0,0 +1,99 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ContentVariant2Item3JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentVariant2Item3 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.PromptCachingBetaRequestTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaRequestTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.PromptCachingBetaRequestImageBlock? image = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.Image) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaRequestImageBlock)}"); + image = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.PromptCachingBetaRequestToolUseBlock? toolUse = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.ToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaRequestToolUseBlock)}"); + toolUse = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.PromptCachingBetaRequestToolResultBlock? toolResult = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.ToolResult) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaRequestToolResultBlock)}"); + toolResult = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ContentVariant2Item3( + discriminator?.Type, + text, + image, + toolUse, + toolResult + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentVariant2Item3 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PromptCachingBetaRequestTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsImage) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PromptCachingBetaRequestImageBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Image, typeInfo); + } + else if (value.IsToolUse) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PromptCachingBetaRequestToolUseBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolUse, typeInfo); + } + else if (value.IsToolResult) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolResult, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item4.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item4.g.cs new file mode 100644 index 0000000..d536f04 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item4.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ContentVariant2Item4JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentVariant2Item4 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.PromptCachingBetaRequestTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaRequestTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.PromptCachingBetaRequestImageBlock? image = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.Image) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaRequestImageBlock)}"); + image = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ContentVariant2Item4( + discriminator?.Type, + text, + image + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentVariant2Item4 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PromptCachingBetaRequestTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsImage) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaRequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PromptCachingBetaRequestImageBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Image, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item5.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item5.g.cs new file mode 100644 index 0000000..167098a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ContentVariant2Item5.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ContentVariant2Item5JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ContentVariant2Item5 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.RequestTextBlock? text = default; + if (discriminator?.Type == global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RequestTextBlock)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.RequestImageBlock? image = default; + if (discriminator?.Type == global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType.Image) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RequestImageBlock)}"); + image = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ContentVariant2Item5( + discriminator?.Type, + text, + image + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ContentVariant2Item5 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestTextBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.RequestTextBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text, typeInfo); + } + else if (value.IsImage) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RequestImageBlock), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.RequestImageBlock).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Image, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.Delta.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Delta.g.cs new file mode 100644 index 0000000..5ff81e5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.Delta.g.cs @@ -0,0 +1,71 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class DeltaJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.Delta Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaTextContentBlockDelta? textDelta = default; + if (discriminator?.Type == global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType.TextDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTextContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaTextContentBlockDelta)}"); + textDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaInputJsonContentBlockDelta? inputJsonDelta = default; + if (discriminator?.Type == global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType.InputJsonDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaInputJsonContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaInputJsonContentBlockDelta)}"); + inputJsonDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.Delta( + discriminator?.Type, + textDelta, + inputJsonDelta + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.Delta value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsTextDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTextContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaTextContentBlockDelta).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.TextDelta, typeInfo); + } + else if (value.IsInputJsonDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaInputJsonContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaInputJsonContentBlockDelta).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.InputJsonDelta, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.BlockDelta.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Delta2.g.cs similarity index 62% rename from src/libs/Anthropic/Generated/JsonConverters.BlockDelta.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.Delta2.g.cs index 45e0b2b..ed7b6ad 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.BlockDelta.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.Delta2.g.cs @@ -4,10 +4,10 @@ namespace Anthropic.JsonConverters { /// - public class BlockDeltaJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public class Delta2JsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.BlockDelta Read( + public override global::Anthropic.Delta2 Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -17,26 +17,26 @@ public class BlockDeltaJsonConverter : global::System.Text.Json.Serialization.Js var readerCopy = reader; - var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BlockDeltaDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BlockDeltaDiscriminator)}"); + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator)}"); var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); - global::Anthropic.TextBlockDelta? textDelta = default; - if (discriminator?.Type == global::Anthropic.BlockDeltaDiscriminatorType.TextDelta) + global::Anthropic.TextContentBlockDelta? textDelta = default; + if (discriminator?.Type == global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType.TextDelta) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.TextBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.TextBlockDelta)}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.TextContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.TextContentBlockDelta)}"); textDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - global::Anthropic.InputJsonBlockDelta? inputJsonDelta = default; - if (discriminator?.Type == global::Anthropic.BlockDeltaDiscriminatorType.InputJsonDelta) + global::Anthropic.InputJsonContentBlockDelta? inputJsonDelta = default; + if (discriminator?.Type == global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType.InputJsonDelta) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.InputJsonBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.InputJsonBlockDelta)}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.InputJsonContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.InputJsonContentBlockDelta)}"); inputJsonDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - var result = new global::Anthropic.BlockDelta( + var result = new global::Anthropic.Delta2( discriminator?.Type, textDelta, inputJsonDelta @@ -48,7 +48,7 @@ public class BlockDeltaJsonConverter : global::System.Text.Json.Serialization.Js /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.BlockDelta value, + global::Anthropic.Delta2 value, global::System.Text.Json.JsonSerializerOptions options) { options = options ?? throw new global::System.ArgumentNullException(nameof(options)); @@ -56,14 +56,14 @@ public override void Write( if (value.IsTextDelta) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.TextBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.TextBlockDelta).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.TextContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.TextContentBlockDelta).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.TextDelta, typeInfo); } else if (value.IsInputJsonDelta) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.InputJsonBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.InputJsonBlockDelta).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.InputJsonContentBlockDelta), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.InputJsonContentBlockDelta).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.InputJsonDelta, typeInfo); } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.Error.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Error.g.cs new file mode 100644 index 0000000..074b7e2 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.Error.g.cs @@ -0,0 +1,141 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ErrorJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.Error Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaErrorResponseErrorDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaErrorResponseErrorDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaInvalidRequestError? invalidRequestError = default; + if (discriminator?.Type == global::Anthropic.BetaErrorResponseErrorDiscriminatorType.InvalidRequestError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaInvalidRequestError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaInvalidRequestError)}"); + invalidRequestError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaAuthenticationError? authenticationError = default; + if (discriminator?.Type == global::Anthropic.BetaErrorResponseErrorDiscriminatorType.AuthenticationError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaAuthenticationError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaAuthenticationError)}"); + authenticationError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaPermissionError? permissionError = default; + if (discriminator?.Type == global::Anthropic.BetaErrorResponseErrorDiscriminatorType.PermissionError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaPermissionError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaPermissionError)}"); + permissionError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaNotFoundError? notFoundError = default; + if (discriminator?.Type == global::Anthropic.BetaErrorResponseErrorDiscriminatorType.NotFoundError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaNotFoundError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaNotFoundError)}"); + notFoundError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaRateLimitError? rateLimitError = default; + if (discriminator?.Type == global::Anthropic.BetaErrorResponseErrorDiscriminatorType.RateLimitError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRateLimitError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaRateLimitError)}"); + rateLimitError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaAPIError? apiError = default; + if (discriminator?.Type == global::Anthropic.BetaErrorResponseErrorDiscriminatorType.ApiError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaAPIError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaAPIError)}"); + apiError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaOverloadedError? overloadedError = default; + if (discriminator?.Type == global::Anthropic.BetaErrorResponseErrorDiscriminatorType.OverloadedError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaOverloadedError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaOverloadedError)}"); + overloadedError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.Error( + discriminator?.Type, + invalidRequestError, + authenticationError, + permissionError, + notFoundError, + rateLimitError, + apiError, + overloadedError + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.Error value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsInvalidRequestError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaInvalidRequestError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaInvalidRequestError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.InvalidRequestError, typeInfo); + } + else if (value.IsAuthenticationError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaAuthenticationError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaAuthenticationError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.AuthenticationError, typeInfo); + } + else if (value.IsPermissionError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaPermissionError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaPermissionError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PermissionError, typeInfo); + } + else if (value.IsNotFoundError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaNotFoundError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaNotFoundError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.NotFoundError, typeInfo); + } + else if (value.IsRateLimitError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaRateLimitError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaRateLimitError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.RateLimitError, typeInfo); + } + else if (value.IsApiError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaAPIError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaAPIError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ApiError, typeInfo); + } + else if (value.IsOverloadedError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaOverloadedError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaOverloadedError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.OverloadedError, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.Error2.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Error2.g.cs new file mode 100644 index 0000000..f411733 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.Error2.g.cs @@ -0,0 +1,141 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class Error2JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.Error2 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ErrorResponseErrorDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ErrorResponseErrorDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.InvalidRequestError? invalidRequestError = default; + if (discriminator?.Type == global::Anthropic.ErrorResponseErrorDiscriminatorType.InvalidRequestError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.InvalidRequestError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.InvalidRequestError)}"); + invalidRequestError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.AuthenticationError? authenticationError = default; + if (discriminator?.Type == global::Anthropic.ErrorResponseErrorDiscriminatorType.AuthenticationError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.AuthenticationError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.AuthenticationError)}"); + authenticationError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.PermissionError? permissionError = default; + if (discriminator?.Type == global::Anthropic.ErrorResponseErrorDiscriminatorType.PermissionError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PermissionError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PermissionError)}"); + permissionError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.NotFoundError? notFoundError = default; + if (discriminator?.Type == global::Anthropic.ErrorResponseErrorDiscriminatorType.NotFoundError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.NotFoundError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.NotFoundError)}"); + notFoundError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.RateLimitError? rateLimitError = default; + if (discriminator?.Type == global::Anthropic.ErrorResponseErrorDiscriminatorType.RateLimitError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RateLimitError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.RateLimitError)}"); + rateLimitError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.APIError? apiError = default; + if (discriminator?.Type == global::Anthropic.ErrorResponseErrorDiscriminatorType.ApiError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.APIError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.APIError)}"); + apiError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.OverloadedError? overloadedError = default; + if (discriminator?.Type == global::Anthropic.ErrorResponseErrorDiscriminatorType.OverloadedError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.OverloadedError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.OverloadedError)}"); + overloadedError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.Error2( + discriminator?.Type, + invalidRequestError, + authenticationError, + permissionError, + notFoundError, + rateLimitError, + apiError, + overloadedError + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.Error2 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsInvalidRequestError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.InvalidRequestError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.InvalidRequestError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.InvalidRequestError, typeInfo); + } + else if (value.IsAuthenticationError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.AuthenticationError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.AuthenticationError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.AuthenticationError, typeInfo); + } + else if (value.IsPermissionError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PermissionError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PermissionError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PermissionError, typeInfo); + } + else if (value.IsNotFoundError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.NotFoundError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.NotFoundError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.NotFoundError, typeInfo); + } + else if (value.IsRateLimitError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.RateLimitError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.RateLimitError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.RateLimitError, typeInfo); + } + else if (value.IsApiError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.APIError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.APIError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ApiError, typeInfo); + } + else if (value.IsOverloadedError) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.OverloadedError), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.OverloadedError).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.OverloadedError, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseErrorDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseErrorDiscriminatorType.g.cs new file mode 100644 index 0000000..79bc5c0 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseErrorDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ErrorResponseErrorDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ErrorResponseErrorDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ErrorResponseErrorDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ErrorResponseErrorDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ErrorResponseErrorDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ErrorResponseErrorDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseErrorDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseErrorDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..9539ed7 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseErrorDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ErrorResponseErrorDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ErrorResponseErrorDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ErrorResponseErrorDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ErrorResponseErrorDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ErrorResponseErrorDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ErrorResponseErrorDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseType.g.cs new file mode 100644 index 0000000..bb8650c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ErrorResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ErrorResponseType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ErrorResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ErrorResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ErrorResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ErrorResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseTypeNullable.g.cs new file mode 100644 index 0000000..5d533d2 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ErrorResponseTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ErrorResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ErrorResponseType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ErrorResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ErrorResponseType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ErrorResponseType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ErrorResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.InputJsonContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputJsonContentBlockDeltaType.g.cs new file mode 100644 index 0000000..3854e08 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InputJsonContentBlockDeltaType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InputJsonContentBlockDeltaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InputJsonContentBlockDeltaType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InputJsonContentBlockDeltaTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InputJsonContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InputJsonContentBlockDeltaType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.InputJsonContentBlockDeltaTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.InputJsonContentBlockDeltaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputJsonContentBlockDeltaTypeNullable.g.cs new file mode 100644 index 0000000..a4bd5e4 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InputJsonContentBlockDeltaTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InputJsonContentBlockDeltaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InputJsonContentBlockDeltaType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InputJsonContentBlockDeltaTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InputJsonContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InputJsonContentBlockDeltaType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.InputJsonContentBlockDeltaTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.InputMessageContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputMessageContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..94ea22d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InputMessageContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InputMessageContentVariant2ItemDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.InputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.InputMessageContentVariant2ItemDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputMessageContentVariant2ItemDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..74ee413 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InputMessageContentVariant2ItemDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InputMessageContentVariant2ItemDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.InputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputMessageRole.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.MessageBatchType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.InputMessageRole.g.cs index ecc4a4a..21c88ca 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.InputMessageRole.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class MessageBatchTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class InputMessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.MessageBatchType Read( + public override global::Anthropic.InputMessageRole Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class MessageBatchTypeJsonConverter : global::System.Text.Json.Ser var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.MessageBatchTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.InputMessageRoleExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class MessageBatchTypeJsonConverter : global::System.Text.Json.Ser case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.MessageBatchType)numValue; + return (global::Anthropic.InputMessageRole)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class MessageBatchTypeJsonConverter : global::System.Text.Json.Ser /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.MessageBatchType value, + global::Anthropic.InputMessageRole value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.MessageBatchTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.InputMessageRoleExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputMessageRoleNullable.g.cs similarity index 77% rename from src/libs/Anthropic/Generated/JsonConverters.MessageBatchTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.InputMessageRoleNullable.g.cs index 593b710..37c780b 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.MessageBatchTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.InputMessageRoleNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class MessageBatchTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class InputMessageRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.MessageBatchType? Read( + public override global::Anthropic.InputMessageRole? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class MessageBatchTypeNullableJsonConverter : global::System.Text. var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.MessageBatchTypeExtensions.ToEnum(stringValue); + return global::Anthropic.InputMessageRoleExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class MessageBatchTypeNullableJsonConverter : global::System.Text. case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.MessageBatchType)numValue; + return (global::Anthropic.InputMessageRole)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class MessageBatchTypeNullableJsonConverter : global::System.Text. /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.MessageBatchType? value, + global::Anthropic.InputMessageRole? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.MessageBatchTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.InputMessageRoleExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.InputSchemaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputSchemaType.g.cs new file mode 100644 index 0000000..7585a24 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InputSchemaType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InputSchemaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InputSchemaType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InputSchemaTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InputSchemaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InputSchemaType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.InputSchemaTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.InputSchemaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InputSchemaTypeNullable.g.cs new file mode 100644 index 0000000..cb585fc --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InputSchemaTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InputSchemaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InputSchemaType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InputSchemaTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InputSchemaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InputSchemaType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.InputSchemaTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.InvalidRequestErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InvalidRequestErrorType.g.cs new file mode 100644 index 0000000..e6bbdcb --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InvalidRequestErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InvalidRequestErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InvalidRequestErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InvalidRequestErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InvalidRequestErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InvalidRequestErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.InvalidRequestErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.InvalidRequestErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.InvalidRequestErrorTypeNullable.g.cs new file mode 100644 index 0000000..bd39d43 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.InvalidRequestErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class InvalidRequestErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.InvalidRequestErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.InvalidRequestErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.InvalidRequestErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.InvalidRequestErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.InvalidRequestErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaEventType.g.cs new file mode 100644 index 0000000..831d450 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageDeltaEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageDeltaEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageDeltaEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageDeltaEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageDeltaEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.MessageDeltaEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaEventTypeNullable.g.cs new file mode 100644 index 0000000..32f2e27 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageDeltaEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageDeltaEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageDeltaEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageDeltaEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageDeltaEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.MessageDeltaEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaStopReason.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaStopReason.g.cs new file mode 100644 index 0000000..293acdd --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaStopReason.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageDeltaStopReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageDeltaStopReason Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageDeltaStopReasonExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageDeltaStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageDeltaStopReason value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.MessageDeltaStopReasonExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaStopReasonNullable.g.cs similarity index 77% rename from src/libs/Anthropic/Generated/JsonConverters.MessageStreamEventTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.MessageDeltaStopReasonNullable.g.cs index 677f3d6..9ddc3c0 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEventTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageDeltaStopReasonNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class MessageStreamEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class MessageDeltaStopReasonNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.MessageStreamEventType? Read( + public override global::Anthropic.MessageDeltaStopReason? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class MessageStreamEventTypeNullableJsonConverter : global::System var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.MessageStreamEventTypeExtensions.ToEnum(stringValue); + return global::Anthropic.MessageDeltaStopReasonExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class MessageStreamEventTypeNullableJsonConverter : global::System case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.MessageStreamEventType)numValue; + return (global::Anthropic.MessageDeltaStopReason)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class MessageStreamEventTypeNullableJsonConverter : global::System /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.MessageStreamEventType? value, + global::Anthropic.MessageDeltaStopReason? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.MessageStreamEventTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.MessageDeltaStopReasonExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStartEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageStartEventType.g.cs new file mode 100644 index 0000000..7ec6bfa --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageStartEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageStartEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageStartEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageStartEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageStartEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.MessageStartEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStartEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageStartEventTypeNullable.g.cs new file mode 100644 index 0000000..eeeabec --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageStartEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageStartEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageStartEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageStartEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageStartEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.MessageStartEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStopEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageStopEventType.g.cs new file mode 100644 index 0000000..1720705 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageStopEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageStopEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageStopEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageStopEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageStopEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.MessageStopEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStopEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageStopEventTypeNullable.g.cs new file mode 100644 index 0000000..f3a22eb --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageStopEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageStopEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageStopEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageStopEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageStopEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageStopEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.MessageStopEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStopReason.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageStopReason.g.cs new file mode 100644 index 0000000..cfdc274 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageStopReason.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageStopReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageStopReason Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageStopReasonExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageStopReason value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.MessageStopReasonExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStopReasonNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageStopReasonNullable.g.cs new file mode 100644 index 0000000..b12dd2f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageStopReasonNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageStopReasonNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageStopReason? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageStopReasonExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageStopReason? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.MessageStopReasonExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEvent.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEvent.g.cs index 31b3c23..48863ad 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEvent.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageStreamEvent.g.cs @@ -15,81 +15,144 @@ public class MessageStreamEventJsonConverter : global::System.Text.Json.Serializ options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - - var readerCopy = reader; - var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStreamEventDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.MessageStreamEventDiscriminator)}"); - var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); - - global::Anthropic.MessageStartEvent? messageStart = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.MessageStart) + var + readerCopy = reader; + global::Anthropic.MessageStartEvent? start = default; + try { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.MessageStartEvent)}"); - messageStart = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageStartEvent).Name}"); + start = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); } - global::Anthropic.MessageDeltaEvent? messageDelta = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.MessageDelta) + catch (global::System.Text.Json.JsonException) + { + } + + readerCopy = reader; + global::Anthropic.MessageDeltaEvent? delta = default; + try { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.MessageDeltaEvent)}"); - messageDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageDeltaEvent).Name}"); + delta = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); } - global::Anthropic.MessageStopEvent? messageStop = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.MessageStop) + catch (global::System.Text.Json.JsonException) + { + } + + readerCopy = reader; + global::Anthropic.MessageStopEvent? stop = default; + try { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.MessageStopEvent)}"); - messageStop = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageStopEvent).Name}"); + stop = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); } + catch (global::System.Text.Json.JsonException) + { + } + + readerCopy = reader; global::Anthropic.ContentBlockStartEvent? contentBlockStart = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.ContentBlockStart) + try { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockStartEvent)}"); - contentBlockStart = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockStartEvent).Name}"); + contentBlockStart = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { } + + readerCopy = reader; global::Anthropic.ContentBlockDeltaEvent? contentBlockDelta = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.ContentBlockDelta) + try { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockDeltaEvent)}"); - contentBlockDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockDeltaEvent).Name}"); + contentBlockDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { } + + readerCopy = reader; global::Anthropic.ContentBlockStopEvent? contentBlockStop = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.ContentBlockStop) + try { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockStopEvent)}"); - contentBlockStop = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockStopEvent).Name}"); + contentBlockStop = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); } - global::Anthropic.PingEvent? ping = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.Ping) + catch (global::System.Text.Json.JsonException) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PingEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PingEvent)}"); - ping = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - global::Anthropic.ErrorEvent? error = default; - if (discriminator?.Type == global::Anthropic.MessageStreamEventDiscriminatorType.Error) + + readerCopy = reader; + global::Anthropic.Ping? ping = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.Ping), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.Ping).Name}"); + ping = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ErrorEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ErrorEvent)}"); - error = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } var result = new global::Anthropic.MessageStreamEvent( - discriminator?.Type, - messageStart, - messageDelta, - messageStop, + start, + delta, + stop, contentBlockStart, contentBlockDelta, contentBlockStop, - ping, - error + ping ); + if (start != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageStartEvent).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (delta != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageDeltaEvent).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (stop != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageStopEvent).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (contentBlockStart != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockStartEvent).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (contentBlockDelta != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockDeltaEvent).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (contentBlockStop != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockStopEvent).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (ping != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.Ping), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.Ping).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + return result; } @@ -102,23 +165,23 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - if (value.IsMessageStart) + if (value.IsStart) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageStartEvent).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageStart, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Start, typeInfo); } - else if (value.IsMessageDelta) + else if (value.IsDelta) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageDeltaEvent).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageDelta, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Delta, typeInfo); } - else if (value.IsMessageStop) + else if (value.IsStop) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageStopEvent).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageStop, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Stop, typeInfo); } else if (value.IsContentBlockStart) { @@ -140,16 +203,10 @@ public override void Write( } else if (value.IsPing) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PingEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PingEvent).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.Ping), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.Ping).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Ping, typeInfo); } - else if (value.IsError) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ErrorEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ErrorEvent).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Error, typeInfo); - } } } } \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageType.g.cs new file mode 100644 index 0000000..5ebadd8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.MessageTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.MessageTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.MessageTypeNullable.g.cs new file mode 100644 index 0000000..286c9db --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.MessageTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class MessageTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.MessageType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.MessageTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.MessageType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.MessageType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.MessageTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.OneOf2.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Model.g.cs similarity index 65% rename from src/libs/Anthropic/Generated/JsonConverters.OneOf2.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.Model.g.cs index 8e3d9cd..9c3c3ea 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.OneOf2.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.Model.g.cs @@ -1,12 +1,13 @@ #nullable enable +#pragma warning disable CS0618 // Type or member is obsolete namespace Anthropic.JsonConverters { /// - public class OneOfJsonConverter : global::System.Text.Json.Serialization.JsonConverter> + public class ModelJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.OneOf Read( + public override global::Anthropic.Model Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -16,11 +17,11 @@ public class OneOfJsonConverter : global::System.Text.Json.Serialization var readerCopy = reader; - T1? value1 = default; + string? value1 = default; try { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); value1 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); } catch (global::System.Text.Json.JsonException) @@ -28,32 +29,32 @@ public class OneOfJsonConverter : global::System.Text.Json.Serialization } readerCopy = reader; - T2? value2 = default; + global::Anthropic.ModelEnum? value2 = default; try { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ModelEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ModelEnum).Name}"); value2 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); } catch (global::System.Text.Json.JsonException) { } - var result = new global::Anthropic.OneOf( + var result = new global::Anthropic.Model( value1, value2 ); if (value1 != null) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } else if (value2 != null) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ModelEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ModelEnum).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } @@ -63,7 +64,7 @@ public class OneOfJsonConverter : global::System.Text.Json.Serialization /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.OneOf value, + global::Anthropic.Model value, global::System.Text.Json.JsonSerializerOptions options) { options = options ?? throw new global::System.ArgumentNullException(nameof(options)); @@ -71,14 +72,14 @@ public override void Write( if (value.IsValue1) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo); } else if (value.IsValue2) { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ModelEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ModelEnum).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2, typeInfo); } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.StopReason.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ModelEnum.g.cs similarity index 71% rename from src/libs/Anthropic/Generated/JsonConverters.StopReason.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.ModelEnum.g.cs index bdd258a..02f069e 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.StopReason.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.ModelEnum.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class StopReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class ModelEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.StopReason Read( + public override global::Anthropic.ModelEnum Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class StopReasonJsonConverter : global::System.Text.Json.Serializa var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.StopReasonExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.ModelEnumExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class StopReasonJsonConverter : global::System.Text.Json.Serializa case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.StopReason)numValue; + return (global::Anthropic.ModelEnum)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class StopReasonJsonConverter : global::System.Text.Json.Serializa /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.StopReason value, + global::Anthropic.ModelEnum value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.StopReasonExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.ModelEnumExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.StopReasonNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ModelEnumNullable.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.StopReasonNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.ModelEnumNullable.g.cs index fcd03fd..c2debbc 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.StopReasonNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.ModelEnumNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class StopReasonNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class ModelEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.StopReason? Read( + public override global::Anthropic.ModelEnum? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class StopReasonNullableJsonConverter : global::System.Text.Json.S var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.StopReasonExtensions.ToEnum(stringValue); + return global::Anthropic.ModelEnumExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class StopReasonNullableJsonConverter : global::System.Text.Json.S case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.StopReason)numValue; + return (global::Anthropic.ModelEnum)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class StopReasonNullableJsonConverter : global::System.Text.Json.S /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.StopReason? value, + global::Anthropic.ModelEnum? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.StopReasonExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.ModelEnumExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.NotFoundErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.NotFoundErrorType.g.cs new file mode 100644 index 0000000..d709d96 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.NotFoundErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class NotFoundErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.NotFoundErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.NotFoundErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.NotFoundErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.NotFoundErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.NotFoundErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.NotFoundErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.NotFoundErrorTypeNullable.g.cs new file mode 100644 index 0000000..9b143d0 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.NotFoundErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class NotFoundErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.NotFoundErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.NotFoundErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.NotFoundErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.NotFoundErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.NotFoundErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.OverloadedErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.OverloadedErrorType.g.cs new file mode 100644 index 0000000..6d99b2b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.OverloadedErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class OverloadedErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.OverloadedErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.OverloadedErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.OverloadedErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.OverloadedErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.OverloadedErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.OverloadedErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.OverloadedErrorTypeNullable.g.cs new file mode 100644 index 0000000..e36c680 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.OverloadedErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class OverloadedErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.OverloadedErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.OverloadedErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.OverloadedErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.OverloadedErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.OverloadedErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PermissionErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PermissionErrorType.g.cs new file mode 100644 index 0000000..eb2cc5f --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PermissionErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PermissionErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PermissionErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PermissionErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PermissionErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PermissionErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PermissionErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PermissionErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PermissionErrorTypeNullable.g.cs new file mode 100644 index 0000000..d37cae6 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PermissionErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PermissionErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PermissionErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PermissionErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PermissionErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PermissionErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PermissionErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PingType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PingType.g.cs new file mode 100644 index 0000000..c4998dc --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PingType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PingTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PingType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PingTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PingType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PingType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PingTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PingTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PingTypeNullable.g.cs new file mode 100644 index 0000000..ec9e55b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PingTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PingTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PingType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PingTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PingType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PingType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PingTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..cc6dcb0 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..a7b0f9d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageRole.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageRole.g.cs new file mode 100644 index 0000000..f58f89c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageRole.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaInputMessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaInputMessageRole Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaInputMessageRoleExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaInputMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaInputMessageRole value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaInputMessageRoleExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageRoleNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageRoleNullable.g.cs new file mode 100644 index 0000000..b065196 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaInputMessageRoleNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaInputMessageRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaInputMessageRole? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaInputMessageRoleExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaInputMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaInputMessageRole? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaInputMessageRoleExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageRole.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageRole.g.cs new file mode 100644 index 0000000..42c8bc3 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageRole.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageRole Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageRoleExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageRole value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageRoleExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageRoleNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageRoleNullable.g.cs new file mode 100644 index 0000000..db24d78 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageRoleNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageRole? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageRoleExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageRole)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageRole? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageRoleExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStartEventType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStartEventType.g.cs new file mode 100644 index 0000000..ba40ace --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStartEventType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageStartEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageStartEventType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageStartEventTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageStartEventType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageStartEventTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStartEventTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStartEventTypeNullable.g.cs new file mode 100644 index 0000000..4cd7eab --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStartEventTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageStartEventTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageStartEventType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageStartEventTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageStartEventType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageStartEventType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageStartEventTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStopReason.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStopReason.g.cs new file mode 100644 index 0000000..e52022c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStopReason.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageStopReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageStopReason Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageStopReasonExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageStopReason value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageStopReasonExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStopReasonNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStopReasonNullable.g.cs new file mode 100644 index 0000000..2344fdc --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStopReasonNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageStopReasonNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageStopReason? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageStopReasonExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageStopReason)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageStopReason? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageStopReasonExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEvent.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEvent.g.cs new file mode 100644 index 0000000..aa83131 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEvent.g.cs @@ -0,0 +1,127 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class PromptCachingBetaMessageStreamEventJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageStreamEvent Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.PromptCachingBetaMessageStartEvent? messageStart = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType.MessageStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaMessageStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.PromptCachingBetaMessageStartEvent)}"); + messageStart = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.MessageDeltaEvent? messageDelta = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType.MessageDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.MessageDeltaEvent)}"); + messageDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.MessageStopEvent? messageStop = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType.MessageStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.MessageStopEvent)}"); + messageStop = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.ContentBlockStartEvent? contentBlockStart = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockStartEvent)}"); + contentBlockStart = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.ContentBlockDeltaEvent? contentBlockDelta = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockDeltaEvent)}"); + contentBlockDelta = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.ContentBlockStopEvent? contentBlockStop = default; + if (discriminator?.Type == global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType.ContentBlockStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ContentBlockStopEvent)}"); + contentBlockStop = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.PromptCachingBetaMessageStreamEvent( + discriminator?.Type, + messageStart, + messageDelta, + messageStop, + contentBlockStart, + contentBlockDelta, + contentBlockStop + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageStreamEvent value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsMessageStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.PromptCachingBetaMessageStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.PromptCachingBetaMessageStartEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageStart, typeInfo); + } + else if (value.IsMessageDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageDeltaEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageDelta, typeInfo); + } + else if (value.IsMessageStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.MessageStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.MessageStopEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageStop, typeInfo); + } + else if (value.IsContentBlockStart) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStartEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockStartEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ContentBlockStart, typeInfo); + } + else if (value.IsContentBlockDelta) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockDeltaEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockDeltaEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ContentBlockDelta, typeInfo); + } + else if (value.IsContentBlockStop) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ContentBlockStopEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ContentBlockStopEvent).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.ContentBlockStop, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorType.g.cs new file mode 100644 index 0000000..8336d1a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageStreamEventDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..ccf3f02 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageStreamEventDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageType.g.cs new file mode 100644 index 0000000..f9603a4 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageTypeNullable.g.cs new file mode 100644 index 0000000..76154c8 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaMessageTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaMessageTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaMessageType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaMessageTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaMessageType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaMessageType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaMessageTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..88798db --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..5c92d89 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorType.g.cs new file mode 100644 index 0000000..41a4cee --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..f7f2e5c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockType.g.cs new file mode 100644 index 0000000..4aa6e7b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestImageBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestImageBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestImageBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestImageBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestImageBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestImageBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockTypeNullable.g.cs new file mode 100644 index 0000000..07946e5 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestImageBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestImageBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestImageBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestImageBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestImageBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestImageBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestImageBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..e12e858 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..87d3ce9 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockType.g.cs new file mode 100644 index 0000000..717ef62 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestTextBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestTextBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestTextBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestTextBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestTextBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockTypeNullable.g.cs new file mode 100644 index 0000000..8d564ca --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestTextBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestTextBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestTextBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestTextBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestTextBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestTextBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..b8754e7 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..77159ea --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..f4ee785 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..f050396 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockType.g.cs new file mode 100644 index 0000000..4e30828 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolResultBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolResultBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolResultBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolResultBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolResultBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolResultBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockTypeNullable.g.cs new file mode 100644 index 0000000..8979ea0 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolResultBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolResultBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolResultBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolResultBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolResultBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolResultBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolResultBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..616da8b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..d2fb5b7 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockType.g.cs new file mode 100644 index 0000000..e701537 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolUseBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolUseBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolUseBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolUseBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolUseBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockTypeNullable.g.cs new file mode 100644 index 0000000..a1fa15b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaRequestToolUseBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaRequestToolUseBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaRequestToolUseBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaRequestToolUseBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaRequestToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaRequestToolUseBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaRequestToolUseBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorType.g.cs new file mode 100644 index 0000000..90c0e57 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaToolCacheControlDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..6a89c98 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class PromptCachingBetaToolCacheControlDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RateLimitErrorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RateLimitErrorType.g.cs new file mode 100644 index 0000000..7b9177b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RateLimitErrorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RateLimitErrorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RateLimitErrorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RateLimitErrorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RateLimitErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RateLimitErrorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.RateLimitErrorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RateLimitErrorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RateLimitErrorTypeNullable.g.cs new file mode 100644 index 0000000..e08951b --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RateLimitErrorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RateLimitErrorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RateLimitErrorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RateLimitErrorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RateLimitErrorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RateLimitErrorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.RateLimitErrorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockSourceDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockSourceDiscriminatorType.g.cs new file mode 100644 index 0000000..94e8c18 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockSourceDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestImageBlockSourceDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestImageBlockSourceDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestImageBlockSourceDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestImageBlockSourceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestImageBlockSourceDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.RequestImageBlockSourceDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockSourceDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockSourceDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..430f47d --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockSourceDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestImageBlockSourceDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestImageBlockSourceDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestImageBlockSourceDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestImageBlockSourceDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestImageBlockSourceDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.RequestImageBlockSourceDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockType.g.cs new file mode 100644 index 0000000..bd8b005 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestImageBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestImageBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestImageBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestImageBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestImageBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.RequestImageBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockTypeNullable.g.cs new file mode 100644 index 0000000..2bb7bba --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestImageBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestImageBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestImageBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestImageBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestImageBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestImageBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.RequestImageBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestTextBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestTextBlockType.g.cs new file mode 100644 index 0000000..340a254 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestTextBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestTextBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestTextBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestTextBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestTextBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.RequestTextBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestTextBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestTextBlockTypeNullable.g.cs new file mode 100644 index 0000000..1f0df59 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestTextBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestTextBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestTextBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestTextBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestTextBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.RequestTextBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs new file mode 100644 index 0000000..d2e60c4 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..f528291 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockType.g.cs new file mode 100644 index 0000000..b21613c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestToolResultBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestToolResultBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestToolResultBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestToolResultBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestToolResultBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.RequestToolResultBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockTypeNullable.g.cs new file mode 100644 index 0000000..89f9228 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestToolResultBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestToolResultBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestToolResultBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestToolResultBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestToolResultBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestToolResultBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.RequestToolResultBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestToolUseBlockType.g.cs new file mode 100644 index 0000000..bfbae18 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestToolUseBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestToolUseBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestToolUseBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestToolUseBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestToolUseBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.RequestToolUseBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.RequestToolUseBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.RequestToolUseBlockTypeNullable.g.cs new file mode 100644 index 0000000..19a9022 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.RequestToolUseBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class RequestToolUseBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.RequestToolUseBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.RequestToolUseBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.RequestToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.RequestToolUseBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.RequestToolUseBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ResponseTextBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ResponseTextBlockType.g.cs new file mode 100644 index 0000000..51118b9 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ResponseTextBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ResponseTextBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ResponseTextBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ResponseTextBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ResponseTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ResponseTextBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ResponseTextBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ResponseTextBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ResponseTextBlockTypeNullable.g.cs new file mode 100644 index 0000000..94c29f1 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ResponseTextBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ResponseTextBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ResponseTextBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ResponseTextBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ResponseTextBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ResponseTextBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ResponseTextBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ResponseToolUseBlockType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ResponseToolUseBlockType.g.cs new file mode 100644 index 0000000..bb086c4 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ResponseToolUseBlockType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ResponseToolUseBlockTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ResponseToolUseBlockType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ResponseToolUseBlockTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ResponseToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ResponseToolUseBlockType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ResponseToolUseBlockTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ResponseToolUseBlockTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ResponseToolUseBlockTypeNullable.g.cs new file mode 100644 index 0000000..f505c46 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ResponseToolUseBlockTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ResponseToolUseBlockTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ResponseToolUseBlockType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ResponseToolUseBlockTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ResponseToolUseBlockType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ResponseToolUseBlockType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ResponseToolUseBlockTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.TextContentBlockDeltaType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.TextContentBlockDeltaType.g.cs new file mode 100644 index 0000000..bf411cc --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.TextContentBlockDeltaType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class TextContentBlockDeltaTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.TextContentBlockDeltaType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.TextContentBlockDeltaTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.TextContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.TextContentBlockDeltaType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.TextContentBlockDeltaTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.TextContentBlockDeltaTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.TextContentBlockDeltaTypeNullable.g.cs new file mode 100644 index 0000000..3bfa86e --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.TextContentBlockDeltaTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class TextContentBlockDeltaTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.TextContentBlockDeltaType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.TextContentBlockDeltaTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.TextContentBlockDeltaType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.TextContentBlockDeltaType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.TextContentBlockDeltaTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.Tool.g.cs b/src/libs/Anthropic/Generated/JsonConverters.Tool.g.cs deleted file mode 100644 index e532904..0000000 --- a/src/libs/Anthropic/Generated/JsonConverters.Tool.g.cs +++ /dev/null @@ -1,137 +0,0 @@ -#nullable enable -#pragma warning disable CS0618 // Type or member is obsolete - -namespace Anthropic.JsonConverters -{ - /// - public class ToolJsonConverter : global::System.Text.Json.Serialization.JsonConverter - { - /// - public override global::Anthropic.Tool Read( - ref global::System.Text.Json.Utf8JsonReader reader, - global::System.Type typeToConvert, - global::System.Text.Json.JsonSerializerOptions options) - { - options = options ?? throw new global::System.ArgumentNullException(nameof(options)); - var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - - var - readerCopy = reader; - global::Anthropic.ToolCustom? custom = default; - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolCustom), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolCustom).Name}"); - custom = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - - readerCopy = reader; - global::Anthropic.ToolComputerUse? computerUse = default; - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolComputerUse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolComputerUse).Name}"); - computerUse = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - - readerCopy = reader; - global::Anthropic.ToolTextEditor? textEditor = default; - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolTextEditor), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolTextEditor).Name}"); - textEditor = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - - readerCopy = reader; - global::Anthropic.ToolBash? bash = default; - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolBash), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolBash).Name}"); - bash = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - - var result = new global::Anthropic.Tool( - custom, - computerUse, - textEditor, - bash - ); - - if (custom != null) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolCustom), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolCustom).Name}"); - _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); - } - else if (computerUse != null) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolComputerUse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolComputerUse).Name}"); - _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); - } - else if (textEditor != null) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolTextEditor), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolTextEditor).Name}"); - _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); - } - else if (bash != null) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolBash), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolBash).Name}"); - _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); - } - - return result; - } - - /// - public override void Write( - global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.Tool value, - global::System.Text.Json.JsonSerializerOptions options) - { - options = options ?? throw new global::System.ArgumentNullException(nameof(options)); - var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - - if (value.IsCustom) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolCustom), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolCustom).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Custom, typeInfo); - } - else if (value.IsComputerUse) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolComputerUse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolComputerUse).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ComputerUse, typeInfo); - } - else if (value.IsTextEditor) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolTextEditor), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolTextEditor).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TextEditor, typeInfo); - } - else if (value.IsBash) - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolBash), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolBash).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Bash, typeInfo); - } - } - } -} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolChoice.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoice.g.cs new file mode 100644 index 0000000..5c60d85 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoice.g.cs @@ -0,0 +1,85 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ToolChoiceJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ToolChoice Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolChoiceDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ToolChoiceDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.ToolChoiceAuto? auto = default; + if (discriminator?.Type == global::Anthropic.ToolChoiceDiscriminatorType.Auto) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolChoiceAuto), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ToolChoiceAuto)}"); + auto = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.ToolChoiceAny? any = default; + if (discriminator?.Type == global::Anthropic.ToolChoiceDiscriminatorType.Any) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolChoiceAny), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ToolChoiceAny)}"); + any = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.ToolChoiceTool? tool = default; + if (discriminator?.Type == global::Anthropic.ToolChoiceDiscriminatorType.Tool) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolChoiceTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.ToolChoiceTool)}"); + tool = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ToolChoice( + discriminator?.Type, + auto, + any, + tool + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ToolChoice value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsAuto) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolChoiceAuto), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolChoiceAuto).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Auto, typeInfo); + } + else if (value.IsAny) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolChoiceAny), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolChoiceAny).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Any, typeInfo); + } + else if (value.IsTool) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.ToolChoiceTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.ToolChoiceTool).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Tool, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAnyType.g.cs similarity index 73% rename from src/libs/Anthropic/Generated/JsonConverters.ToolChoiceType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAnyType.g.cs index 3be84ad..830c7fd 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAnyType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ToolChoiceTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class ToolChoiceAnyTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ToolChoiceType Read( + public override global::Anthropic.ToolChoiceAnyType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ToolChoiceTypeJsonConverter : global::System.Text.Json.Seria var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ToolChoiceTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.ToolChoiceAnyTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class ToolChoiceTypeJsonConverter : global::System.Text.Json.Seria case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ToolChoiceType)numValue; + return (global::Anthropic.ToolChoiceAnyType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class ToolChoiceTypeJsonConverter : global::System.Text.Json.Seria /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ToolChoiceType value, + global::Anthropic.ToolChoiceAnyType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.ToolChoiceTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.ToolChoiceAnyTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAnyTypeNullable.g.cs similarity index 74% rename from src/libs/Anthropic/Generated/JsonConverters.ToolChoiceTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAnyTypeNullable.g.cs index 41ecbf0..4322ec6 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAnyTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class ToolChoiceTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class ToolChoiceAnyTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.ToolChoiceType? Read( + public override global::Anthropic.ToolChoiceAnyType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class ToolChoiceTypeNullableJsonConverter : global::System.Text.Js var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.ToolChoiceTypeExtensions.ToEnum(stringValue); + return global::Anthropic.ToolChoiceAnyTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class ToolChoiceTypeNullableJsonConverter : global::System.Text.Js case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.ToolChoiceType)numValue; + return (global::Anthropic.ToolChoiceAnyType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class ToolChoiceTypeNullableJsonConverter : global::System.Text.Js /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.ToolChoiceType? value, + global::Anthropic.ToolChoiceAnyType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.ToolChoiceTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.ToolChoiceAnyTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAutoType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAutoType.g.cs new file mode 100644 index 0000000..9184e5c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAutoType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ToolChoiceAutoTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ToolChoiceAutoType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ToolChoiceAutoTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ToolChoiceAutoType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ToolChoiceAutoType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ToolChoiceAutoTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAutoTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAutoTypeNullable.g.cs new file mode 100644 index 0000000..49c197e --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceAutoTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ToolChoiceAutoTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ToolChoiceAutoType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ToolChoiceAutoTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ToolChoiceAutoType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ToolChoiceAutoType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ToolChoiceAutoTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.BlockDeltaDiscriminatorType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceDiscriminatorType.g.cs similarity index 77% rename from src/libs/Anthropic/Generated/JsonConverters.BlockDeltaDiscriminatorType.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.ToolChoiceDiscriminatorType.g.cs index 181fef3..371f632 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.BlockDeltaDiscriminatorType.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceDiscriminatorType.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class BlockDeltaDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class ToolChoiceDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.BlockDeltaDiscriminatorType Read( + public override global::Anthropic.ToolChoiceDiscriminatorType Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class BlockDeltaDiscriminatorTypeJsonConverter : global::System.Te var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.BlockDeltaDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + return global::Anthropic.ToolChoiceDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; } break; @@ -26,7 +26,7 @@ public sealed class BlockDeltaDiscriminatorTypeJsonConverter : global::System.Te case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.BlockDeltaDiscriminatorType)numValue; + return (global::Anthropic.ToolChoiceDiscriminatorType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,12 +38,12 @@ public sealed class BlockDeltaDiscriminatorTypeJsonConverter : global::System.Te /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.BlockDeltaDiscriminatorType value, + global::Anthropic.ToolChoiceDiscriminatorType value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); - writer.WriteStringValue(global::Anthropic.BlockDeltaDiscriminatorTypeExtensions.ToValueString(value)); + writer.WriteStringValue(global::Anthropic.ToolChoiceDiscriminatorTypeExtensions.ToValueString(value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.BlockDeltaDiscriminatorTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceDiscriminatorTypeNullable.g.cs similarity index 76% rename from src/libs/Anthropic/Generated/JsonConverters.BlockDeltaDiscriminatorTypeNullable.g.cs rename to src/libs/Anthropic/Generated/JsonConverters.ToolChoiceDiscriminatorTypeNullable.g.cs index 34ac400..397ac80 100644 --- a/src/libs/Anthropic/Generated/JsonConverters.BlockDeltaDiscriminatorTypeNullable.g.cs +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceDiscriminatorTypeNullable.g.cs @@ -3,10 +3,10 @@ namespace Anthropic.JsonConverters { /// - public sealed class BlockDeltaDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + public sealed class ToolChoiceDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter { /// - public override global::Anthropic.BlockDeltaDiscriminatorType? Read( + public override global::Anthropic.ToolChoiceDiscriminatorType? Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -18,7 +18,7 @@ public sealed class BlockDeltaDiscriminatorTypeNullableJsonConverter : global::S var stringValue = reader.GetString(); if (stringValue != null) { - return global::Anthropic.BlockDeltaDiscriminatorTypeExtensions.ToEnum(stringValue); + return global::Anthropic.ToolChoiceDiscriminatorTypeExtensions.ToEnum(stringValue); } break; @@ -26,7 +26,7 @@ public sealed class BlockDeltaDiscriminatorTypeNullableJsonConverter : global::S case global::System.Text.Json.JsonTokenType.Number: { var numValue = reader.GetInt32(); - return (global::Anthropic.BlockDeltaDiscriminatorType)numValue; + return (global::Anthropic.ToolChoiceDiscriminatorType)numValue; } default: throw new global::System.ArgumentOutOfRangeException(nameof(reader)); @@ -38,7 +38,7 @@ public sealed class BlockDeltaDiscriminatorTypeNullableJsonConverter : global::S /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::Anthropic.BlockDeltaDiscriminatorType? value, + global::Anthropic.ToolChoiceDiscriminatorType? value, global::System.Text.Json.JsonSerializerOptions options) { writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); @@ -49,7 +49,7 @@ public override void Write( } else { - writer.WriteStringValue(global::Anthropic.BlockDeltaDiscriminatorTypeExtensions.ToValueString(value.Value)); + writer.WriteStringValue(global::Anthropic.ToolChoiceDiscriminatorTypeExtensions.ToValueString(value.Value)); } } } diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceToolType.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceToolType.g.cs new file mode 100644 index 0000000..500894c --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceToolType.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ToolChoiceToolTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ToolChoiceToolType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ToolChoiceToolTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ToolChoiceToolType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ToolChoiceToolType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Anthropic.ToolChoiceToolTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceToolTypeNullable.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceToolTypeNullable.g.cs new file mode 100644 index 0000000..b21c37a --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolChoiceToolTypeNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace Anthropic.JsonConverters +{ + /// + public sealed class ToolChoiceToolTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ToolChoiceToolType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Anthropic.ToolChoiceToolTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Anthropic.ToolChoiceToolType)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ToolChoiceToolType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Anthropic.ToolChoiceToolTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolsItem.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolsItem.g.cs new file mode 100644 index 0000000..887d039 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolsItem.g.cs @@ -0,0 +1,99 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ToolsItemJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ToolsItem Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaTool? custom = default; + if (discriminator?.Type == global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType.Custom) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaTool)}"); + custom = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaComputerUseTool20241022? computer20241022 = default; + if (discriminator?.Type == global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType.Computer20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaComputerUseTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaComputerUseTool20241022)}"); + computer20241022 = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaBashTool20241022? bash20241022 = default; + if (discriminator?.Type == global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType.Bash20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaBashTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaBashTool20241022)}"); + bash20241022 = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaTextEditor20241022? textEditor20241022 = default; + if (discriminator?.Type == global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType.TextEditor20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTextEditor20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaTextEditor20241022)}"); + textEditor20241022 = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ToolsItem( + discriminator?.Type, + custom, + computer20241022, + bash20241022, + textEditor20241022 + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ToolsItem value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsCustom) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaTool).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Custom, typeInfo); + } + else if (value.IsComputer20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaComputerUseTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaComputerUseTool20241022).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Computer20241022, typeInfo); + } + else if (value.IsBash20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaBashTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaBashTool20241022).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Bash20241022, typeInfo); + } + else if (value.IsTextEditor20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTextEditor20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaTextEditor20241022).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.TextEditor20241022, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonConverters.ToolsItem2.g.cs b/src/libs/Anthropic/Generated/JsonConverters.ToolsItem2.g.cs new file mode 100644 index 0000000..ddd8693 --- /dev/null +++ b/src/libs/Anthropic/Generated/JsonConverters.ToolsItem2.g.cs @@ -0,0 +1,99 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Anthropic.JsonConverters +{ + /// + public class ToolsItem2JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Anthropic.ToolsItem2 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaCreateMessageParamsToolDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaCreateMessageParamsToolDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Anthropic.BetaTool? custom = default; + if (discriminator?.Type == global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType.Custom) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaTool)}"); + custom = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaComputerUseTool20241022? computer20241022 = default; + if (discriminator?.Type == global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType.Computer20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaComputerUseTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaComputerUseTool20241022)}"); + computer20241022 = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaBashTool20241022? bash20241022 = default; + if (discriminator?.Type == global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType.Bash20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaBashTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaBashTool20241022)}"); + bash20241022 = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Anthropic.BetaTextEditor20241022? textEditor20241022 = default; + if (discriminator?.Type == global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType.TextEditor20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTextEditor20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Anthropic.BetaTextEditor20241022)}"); + textEditor20241022 = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var result = new global::Anthropic.ToolsItem2( + discriminator?.Type, + custom, + computer20241022, + bash20241022, + textEditor20241022 + ); + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Anthropic.ToolsItem2 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsCustom) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaTool).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Custom, typeInfo); + } + else if (value.IsComputer20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaComputerUseTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaComputerUseTool20241022).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Computer20241022, typeInfo); + } + else if (value.IsBash20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaBashTool20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaBashTool20241022).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Bash20241022, typeInfo); + } + else if (value.IsTextEditor20241022) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Anthropic.BetaTextEditor20241022), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Anthropic.BetaTextEditor20241022).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.TextEditor20241022, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/JsonSerializerContext.g.cs b/src/libs/Anthropic/Generated/JsonSerializerContext.g.cs index 4235b0d..7b2ff1e 100644 --- a/src/libs/Anthropic/Generated/JsonSerializerContext.g.cs +++ b/src/libs/Anthropic/Generated/JsonSerializerContext.g.cs @@ -13,48 +13,313 @@ namespace Anthropic DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, Converters = new global::System.Type[] { - typeof(global::Anthropic.JsonConverters.CreateMessageRequestModelJsonConverter), - typeof(global::Anthropic.JsonConverters.CreateMessageRequestModelNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.TextBlockTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.TextBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.APIErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.APIErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.AuthenticationErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.AuthenticationErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.Base64ImageSourceTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.Base64ImageSourceTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.Base64ImageSourceMediaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.Base64ImageSourceMediaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaAPIErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaAPIErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaAuthenticationErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaAuthenticationErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64ImageSourceTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64ImageSourceTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64ImageSourceMediaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64ImageSourceMediaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64PDFSourceTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64PDFSourceTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64PDFSourceMediaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBase64PDFSourceMediaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCacheControlEphemeralTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCacheControlEphemeralTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBashTool20241022CacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBashTool20241022CacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBashTool20241022TypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBashTool20241022TypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBashTool20241022NameJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaBashTool20241022NameNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCanceledResultTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCanceledResultTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022CacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022TypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022TypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022NameJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaComputerUseTool20241022NameNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockDeltaEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockDeltaEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextContentBlockDeltaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextContentBlockDeltaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputJsonContentBlockDeltaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputJsonContentBlockDeltaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockDeltaEventDeltaDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockStartEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockStartEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaResponseTextBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaResponseTextBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaResponseToolUseBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaResponseToolUseBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockStartEventContentBlockDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockStopEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockStopEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceAutoTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceAutoTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceAnyTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceAnyTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceToolTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceToolTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputSchemaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputSchemaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022CacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022TypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022TypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022NameJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaTextEditor20241022NameNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCountMessageTokensParamsToolDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputMessageRoleJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputMessageRoleNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestTextBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestTextBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestTextBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockSourceDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestImageBlockSourceDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolUseBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolUseBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolUseBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestPDFBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestPDFBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRequestPDFBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputContentBlockDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputContentBlockDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ModelEnumJsonConverter), + typeof(global::Anthropic.JsonConverters.ModelEnumNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCreateMessageParamsToolDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaCreateMessageParamsToolDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaErrorResponseTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaErrorResponseTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInvalidRequestErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInvalidRequestErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaPermissionErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaPermissionErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaNotFoundErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaNotFoundErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRateLimitErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaRateLimitErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaOverloadedErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaOverloadedErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaErrorResponseErrorDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaErrorResponseErrorDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaErroredResultTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaErroredResultTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaExpiredResultTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaExpiredResultTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageBatchTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageBatchTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageBatchProcessingStatusJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageBatchProcessingStatusNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageRoleJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageRoleNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStopReasonJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStopReasonNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaSucceededResultTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaSucceededResultTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageBatchResultDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageBatchResultDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageDeltaStopReasonJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageDeltaStopReasonNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageDeltaEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageDeltaEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStartEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStartEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStopEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStopEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStreamEventDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStreamEventDiscriminatorTypeNullableJsonConverter), typeof(global::Anthropic.JsonConverters.CacheControlEphemeralTypeJsonConverter), typeof(global::Anthropic.JsonConverters.CacheControlEphemeralTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.ImageBlockSourceMediaTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.ImageBlockSourceMediaTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.ImageBlockSourceTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.ImageBlockSourceTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.ImageBlockTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.ImageBlockTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.ToolUseBlockTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.ToolUseBlockTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.ToolResultBlockTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.ToolResultBlockTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.BlockDiscriminatorTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.BlockDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.CompletionResponseTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.CompletionResponseTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockDeltaEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockDeltaEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.TextContentBlockDeltaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.TextContentBlockDeltaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.InputJsonContentBlockDeltaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.InputJsonContentBlockDeltaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockDeltaEventDeltaDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockStartEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockStartEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ResponseTextBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ResponseTextBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ResponseToolUseBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ResponseToolUseBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockStartEventContentBlockDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockStartEventContentBlockDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockStopEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockStopEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.InputMessageRoleJsonConverter), + typeof(global::Anthropic.JsonConverters.InputMessageRoleNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestTextBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestTextBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestImageBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestImageBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestImageBlockSourceDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestImageBlockSourceDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestToolUseBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestToolUseBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestToolResultBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestToolResultBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.RequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.InputMessageContentVariant2ItemDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.InputMessageContentVariant2ItemDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceAutoTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceAutoTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceAnyTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceAnyTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceToolTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceToolTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.InputSchemaTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.InputSchemaTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ErrorResponseTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ErrorResponseTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.InvalidRequestErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.InvalidRequestErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PermissionErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PermissionErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.NotFoundErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.NotFoundErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.RateLimitErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.RateLimitErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.OverloadedErrorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.OverloadedErrorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ErrorResponseErrorDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ErrorResponseErrorDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageTypeNullableJsonConverter), typeof(global::Anthropic.JsonConverters.MessageRoleJsonConverter), typeof(global::Anthropic.JsonConverters.MessageRoleNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.StopReasonJsonConverter), - typeof(global::Anthropic.JsonConverters.StopReasonNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.ToolChoiceTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.ToolChoiceTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.MessageBatchProcessingStatusJsonConverter), - typeof(global::Anthropic.JsonConverters.MessageBatchProcessingStatusNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.MessageBatchTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.MessageBatchTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.MessageStreamEventTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.BlockDeltaDiscriminatorTypeJsonConverter), - typeof(global::Anthropic.JsonConverters.BlockDeltaDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageStopReasonJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageStopReasonNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageDeltaStopReasonJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageDeltaStopReasonNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageDeltaEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageDeltaEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageStartEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageStartEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageStopEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.MessageStopEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PingTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PingTypeNullableJsonConverter), typeof(global::Anthropic.JsonConverters.MessageStreamEventDiscriminatorTypeJsonConverter), typeof(global::Anthropic.JsonConverters.MessageStreamEventDiscriminatorTypeNullableJsonConverter), - typeof(global::Anthropic.JsonConverters.BlockJsonConverter), - typeof(global::Anthropic.JsonConverters.ToolJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaInputMessageRoleJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaInputMessageRoleNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestTextBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestTextBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestImageBlockSourceDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolUseBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolUseBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaToolCacheControlDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageRoleJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageRoleNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStopReasonJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStopReasonNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStartEventTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStartEventTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorTypeJsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStreamEventDiscriminatorTypeNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.AnthropicBetaEnumJsonConverter), + typeof(global::Anthropic.JsonConverters.AnthropicBetaEnumNullableJsonConverter), + typeof(global::Anthropic.JsonConverters.DeltaJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlockJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaToolChoiceJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolsItemJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaInputContentBlockJsonConverter), + typeof(global::Anthropic.JsonConverters.ContentVariant2ItemJsonConverter), + typeof(global::Anthropic.JsonConverters.ModelJsonConverter), + typeof(global::Anthropic.JsonConverters.ToolsItem2JsonConverter), + typeof(global::Anthropic.JsonConverters.ErrorJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaContentBlockJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageBatchResultJsonConverter), + typeof(global::Anthropic.JsonConverters.BetaMessageStreamEventJsonConverter), + typeof(global::Anthropic.JsonConverters.Delta2JsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlock2JsonConverter), + typeof(global::Anthropic.JsonConverters.ContentVariant2Item2JsonConverter), + typeof(global::Anthropic.JsonConverters.ContentVariant2Item5JsonConverter), + typeof(global::Anthropic.JsonConverters.ToolChoiceJsonConverter), + typeof(global::Anthropic.JsonConverters.Error2JsonConverter), + typeof(global::Anthropic.JsonConverters.ContentBlock3JsonConverter), typeof(global::Anthropic.JsonConverters.MessageStreamEventJsonConverter), - typeof(global::Anthropic.JsonConverters.BlockDeltaJsonConverter), - typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter), - typeof(global::Anthropic.JsonConverters.OneOfJsonConverter>), - typeof(global::Anthropic.JsonConverters.OneOfJsonConverter>), - typeof(global::Anthropic.JsonConverters.OneOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.ContentVariant2Item3JsonConverter), + typeof(global::Anthropic.JsonConverters.ContentVariant2Item4JsonConverter), + typeof(global::Anthropic.JsonConverters.PromptCachingBetaMessageStreamEventJsonConverter), + typeof(global::Anthropic.JsonConverters.AnthropicBetaJsonConverter), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), + typeof(global::Anthropic.JsonConverters.AnyOfJsonConverter>), typeof(global::Anthropic.JsonConverters.UnixTimestampJsonConverter), })] diff --git a/src/libs/Anthropic/Generated/JsonSerializerContextTypes.g.cs b/src/libs/Anthropic/Generated/JsonSerializerContextTypes.g.cs index 0932050..7716f80 100644 --- a/src/libs/Anthropic/Generated/JsonSerializerContextTypes.g.cs +++ b/src/libs/Anthropic/Generated/JsonSerializerContextTypes.g.cs @@ -18,11 +18,11 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Anthropic.CreateMessageRequest? Type0 { get; set; } + public global::Anthropic.APIError? Type0 { get; set; } /// /// /// - public global::Anthropic.AnyOf? Type1 { get; set; } + public global::Anthropic.APIErrorType? Type1 { get; set; } /// /// /// @@ -30,270 +30,1346 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Anthropic.CreateMessageRequestModel? Type3 { get; set; } + public global::Anthropic.AuthenticationError? Type3 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type4 { get; set; } + public global::Anthropic.AuthenticationErrorType? Type4 { get; set; } /// /// /// - public global::Anthropic.Message? Type5 { get; set; } + public global::Anthropic.Base64ImageSource? Type5 { get; set; } /// /// /// - public global::Anthropic.OneOf>? Type6 { get; set; } + public global::Anthropic.Base64ImageSourceType? Type6 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type7 { get; set; } + public global::Anthropic.Base64ImageSourceMediaType? Type7 { get; set; } /// /// /// - public global::Anthropic.Block? Type8 { get; set; } + public byte[]? Type8 { get; set; } /// /// /// - public global::Anthropic.TextBlock? Type9 { get; set; } + public global::Anthropic.BetaAPIError? Type9 { get; set; } /// /// /// - public global::Anthropic.TextBlockType? Type10 { get; set; } + public global::Anthropic.BetaAPIErrorType? Type10 { get; set; } /// /// /// - public global::Anthropic.CacheControlEphemeral? Type11 { get; set; } + public global::Anthropic.BetaAuthenticationError? Type11 { get; set; } /// /// /// - public global::Anthropic.CacheControlEphemeralType? Type12 { get; set; } + public global::Anthropic.BetaAuthenticationErrorType? Type12 { get; set; } /// /// /// - public global::Anthropic.ImageBlock? Type13 { get; set; } + public global::Anthropic.BetaBase64ImageSource? Type13 { get; set; } /// /// /// - public global::Anthropic.ImageBlockSource? Type14 { get; set; } + public global::Anthropic.BetaBase64ImageSourceType? Type14 { get; set; } /// /// /// - public global::Anthropic.ImageBlockSourceMediaType? Type15 { get; set; } + public global::Anthropic.BetaBase64ImageSourceMediaType? Type15 { get; set; } /// /// /// - public global::Anthropic.ImageBlockSourceType? Type16 { get; set; } + public global::Anthropic.BetaBase64PDFSource? Type16 { get; set; } /// /// /// - public global::Anthropic.ImageBlockType? Type17 { get; set; } + public global::Anthropic.BetaBase64PDFSourceType? Type17 { get; set; } /// /// /// - public global::Anthropic.ToolUseBlock? Type18 { get; set; } + public global::Anthropic.BetaBase64PDFSourceMediaType? Type18 { get; set; } /// /// /// - public object? Type19 { get; set; } + public global::Anthropic.BetaBashTool20241022? Type19 { get; set; } /// /// /// - public global::Anthropic.ToolUseBlockType? Type20 { get; set; } + public global::Anthropic.BetaCacheControlEphemeral? Type20 { get; set; } /// /// /// - public global::Anthropic.ToolResultBlock? Type21 { get; set; } + public global::Anthropic.BetaCacheControlEphemeralType? Type21 { get; set; } /// /// /// - public global::Anthropic.BlockDiscriminator? Type22 { get; set; } + public global::Anthropic.BetaBashTool20241022CacheControlDiscriminator? Type22 { get; set; } /// /// /// - public bool? Type23 { get; set; } + public global::Anthropic.BetaBashTool20241022CacheControlDiscriminatorType? Type23 { get; set; } /// /// /// - public global::Anthropic.ToolResultBlockType? Type24 { get; set; } + public global::Anthropic.BetaBashTool20241022Type? Type24 { get; set; } /// /// /// - public global::Anthropic.BlockDiscriminatorType? Type25 { get; set; } + public global::Anthropic.BetaBashTool20241022Name? Type25 { get; set; } /// /// /// - public global::Anthropic.MessageRole? Type26 { get; set; } + public global::Anthropic.BetaCanceledResult? Type26 { get; set; } /// /// /// - public global::Anthropic.StopReason? Type27 { get; set; } + public global::Anthropic.BetaCanceledResultType? Type27 { get; set; } /// /// /// - public global::Anthropic.Usage? Type28 { get; set; } + public global::Anthropic.BetaComputerUseTool20241022? Type28 { get; set; } /// /// /// - public int? Type29 { get; set; } + public global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminator? Type29 { get; set; } /// /// /// - public global::Anthropic.CreateMessageRequestMetadata? Type30 { get; set; } + public global::Anthropic.BetaComputerUseTool20241022CacheControlDiscriminatorType? Type30 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type31 { get; set; } + public global::Anthropic.BetaComputerUseTool20241022Type? Type31 { get; set; } /// /// /// - public double? Type32 { get; set; } + public global::Anthropic.BetaComputerUseTool20241022Name? Type32 { get; set; } /// /// /// - public global::Anthropic.ToolChoice? Type33 { get; set; } + public int? Type33 { get; set; } /// /// /// - public global::Anthropic.ToolChoiceType? Type34 { get; set; } + public global::Anthropic.BetaContentBlockDeltaEvent? Type34 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type35 { get; set; } + public global::Anthropic.BetaContentBlockDeltaEventType? Type35 { get; set; } /// /// /// - public global::Anthropic.Tool? Type36 { get; set; } + public global::Anthropic.Delta? Type36 { get; set; } /// /// /// - public global::Anthropic.ToolCustom? Type37 { get; set; } + public global::Anthropic.BetaTextContentBlockDelta? Type37 { get; set; } /// /// /// - public global::Anthropic.ToolComputerUse? Type38 { get; set; } + public global::Anthropic.BetaTextContentBlockDeltaType? Type38 { get; set; } /// /// /// - public global::Anthropic.ToolTextEditor? Type39 { get; set; } + public global::Anthropic.BetaInputJsonContentBlockDelta? Type39 { get; set; } /// /// /// - public global::Anthropic.ToolBash? Type40 { get; set; } + public global::Anthropic.BetaInputJsonContentBlockDeltaType? Type40 { get; set; } /// /// /// - public global::Anthropic.ToolDiscriminator? Type41 { get; set; } + public global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminator? Type41 { get; set; } /// /// /// - public global::Anthropic.CreateMessageBatchRequest? Type42 { get; set; } + public global::Anthropic.BetaContentBlockDeltaEventDeltaDiscriminatorType? Type42 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type43 { get; set; } + public global::Anthropic.BetaContentBlockStartEvent? Type43 { get; set; } /// /// /// - public global::Anthropic.BatchMessageRequest? Type44 { get; set; } + public global::Anthropic.BetaContentBlockStartEventType? Type44 { get; set; } /// /// /// - public global::Anthropic.MessageBatch? Type45 { get; set; } + public global::Anthropic.ContentBlock? Type45 { get; set; } /// /// /// - public global::System.DateTime? Type46 { get; set; } + public global::Anthropic.BetaResponseTextBlock? Type46 { get; set; } /// /// /// - public global::Anthropic.MessageBatchProcessingStatus? Type47 { get; set; } + public global::Anthropic.BetaResponseTextBlockType? Type47 { get; set; } /// /// /// - public global::Anthropic.MessageBatchRequestCounts? Type48 { get; set; } + public global::Anthropic.BetaResponseToolUseBlock? Type48 { get; set; } /// /// /// - public global::Anthropic.MessageBatchType? Type49 { get; set; } + public global::Anthropic.BetaResponseToolUseBlockType? Type49 { get; set; } /// /// /// - public global::Anthropic.MessageStreamEvent? Type50 { get; set; } + public object? Type50 { get; set; } /// /// /// - public global::Anthropic.MessageStartEvent? Type51 { get; set; } + public global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminator? Type51 { get; set; } /// /// /// - public global::Anthropic.MessageStreamEventType? Type52 { get; set; } + public global::Anthropic.BetaContentBlockStartEventContentBlockDiscriminatorType? Type52 { get; set; } /// /// /// - public global::Anthropic.MessageDeltaEvent? Type53 { get; set; } + public global::Anthropic.BetaContentBlockStopEvent? Type53 { get; set; } /// /// /// - public global::Anthropic.MessageDelta? Type54 { get; set; } + public global::Anthropic.BetaContentBlockStopEventType? Type54 { get; set; } /// /// /// - public global::Anthropic.MessageDeltaUsage? Type55 { get; set; } + public global::Anthropic.BetaCountMessageTokensParams? Type55 { get; set; } /// /// /// - public global::Anthropic.MessageStopEvent? Type56 { get; set; } + public global::Anthropic.BetaToolChoice? Type56 { get; set; } /// /// /// - public global::Anthropic.ContentBlockStartEvent? Type57 { get; set; } + public global::Anthropic.BetaToolChoiceAuto? Type57 { get; set; } /// /// /// - public global::Anthropic.ContentBlockDeltaEvent? Type58 { get; set; } + public global::Anthropic.BetaToolChoiceAutoType? Type58 { get; set; } /// /// /// - public global::Anthropic.BlockDelta? Type59 { get; set; } + public bool? Type59 { get; set; } /// /// /// - public global::Anthropic.TextBlockDelta? Type60 { get; set; } + public global::Anthropic.BetaToolChoiceAny? Type60 { get; set; } /// /// /// - public global::Anthropic.InputJsonBlockDelta? Type61 { get; set; } + public global::Anthropic.BetaToolChoiceAnyType? Type61 { get; set; } /// /// /// - public global::Anthropic.BlockDeltaDiscriminator? Type62 { get; set; } + public global::Anthropic.BetaToolChoiceTool? Type62 { get; set; } /// /// /// - public global::Anthropic.BlockDeltaDiscriminatorType? Type63 { get; set; } + public global::Anthropic.BetaToolChoiceToolType? Type63 { get; set; } /// /// /// - public global::Anthropic.ContentBlockStopEvent? Type64 { get; set; } + public global::Anthropic.BetaToolChoiceDiscriminator? Type64 { get; set; } /// /// /// - public global::Anthropic.PingEvent? Type65 { get; set; } + public global::Anthropic.BetaToolChoiceDiscriminatorType? Type65 { get; set; } /// /// /// - public global::Anthropic.ErrorEvent? Type66 { get; set; } + public global::System.Collections.Generic.IList? Type66 { get; set; } /// /// /// - public global::Anthropic.Error? Type67 { get; set; } + public global::Anthropic.ToolsItem? Type67 { get; set; } /// /// /// - public global::Anthropic.MessageStreamEventDiscriminator? Type68 { get; set; } + public global::Anthropic.BetaTool? Type68 { get; set; } /// /// /// - public global::Anthropic.MessageStreamEventDiscriminatorType? Type69 { get; set; } + public global::Anthropic.BetaToolType? Type69 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInputSchema? Type70 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInputSchemaType? Type71 { get; set; } + /// + /// + /// + public global::Anthropic.BetaToolCacheControlDiscriminator? Type72 { get; set; } + /// + /// + /// + public global::Anthropic.BetaToolCacheControlDiscriminatorType? Type73 { get; set; } + /// + /// + /// + public global::Anthropic.BetaTextEditor20241022? Type74 { get; set; } + /// + /// + /// + public global::Anthropic.BetaTextEditor20241022CacheControlDiscriminator? Type75 { get; set; } + /// + /// + /// + public global::Anthropic.BetaTextEditor20241022CacheControlDiscriminatorType? Type76 { get; set; } + /// + /// + /// + public global::Anthropic.BetaTextEditor20241022Type? Type77 { get; set; } + /// + /// + /// + public global::Anthropic.BetaTextEditor20241022Name? Type78 { get; set; } + /// + /// + /// + public global::Anthropic.BetaCountMessageTokensParamsToolDiscriminator? Type79 { get; set; } + /// + /// + /// + public global::Anthropic.BetaCountMessageTokensParamsToolDiscriminatorType? Type80 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type81 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInputMessage? Type82 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInputMessageRole? Type83 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type84 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type85 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInputContentBlock? Type86 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestTextBlock? Type87 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestTextBlockCacheControlDiscriminator? Type88 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestTextBlockCacheControlDiscriminatorType? Type89 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestTextBlockType? Type90 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestImageBlock? Type91 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestImageBlockCacheControlDiscriminator? Type92 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestImageBlockCacheControlDiscriminatorType? Type93 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestImageBlockType? Type94 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestImageBlockSourceDiscriminator? Type95 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestImageBlockSourceDiscriminatorType? Type96 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolUseBlock? Type97 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminator? Type98 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolUseBlockCacheControlDiscriminatorType? Type99 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolUseBlockType? Type100 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolResultBlock? Type101 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminator? Type102 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolResultBlockCacheControlDiscriminatorType? Type103 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolResultBlockType? Type104 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type105 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type106 { get; set; } + /// + /// + /// + public global::Anthropic.ContentVariant2Item? Type107 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminator? Type108 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Type109 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestPDFBlock? Type110 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminator? Type111 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestPDFBlockCacheControlDiscriminatorType? Type112 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestPDFBlockType? Type113 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInputContentBlockDiscriminator? Type114 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInputContentBlockDiscriminatorType? Type115 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type116 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type117 { get; set; } + /// + /// + /// + public global::Anthropic.Model? Type118 { get; set; } + /// + /// + /// + public global::Anthropic.ModelEnum? Type119 { get; set; } + /// + /// + /// + public global::Anthropic.BetaCountMessageTokensResponse? Type120 { get; set; } + /// + /// + /// + public global::Anthropic.BetaCreateMessageBatchParams? Type121 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type122 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatchIndividualRequestParams? Type123 { get; set; } + /// + /// + /// + public global::Anthropic.BetaCreateMessageParams? Type124 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMetadata? Type125 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type126 { get; set; } + /// + /// + /// + public double? Type127 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type128 { get; set; } + /// + /// + /// + public global::Anthropic.ToolsItem2? Type129 { get; set; } + /// + /// + /// + public global::Anthropic.BetaCreateMessageParamsToolDiscriminator? Type130 { get; set; } + /// + /// + /// + public global::Anthropic.BetaCreateMessageParamsToolDiscriminatorType? Type131 { get; set; } + /// + /// + /// + public global::Anthropic.BetaErrorResponse? Type132 { get; set; } + /// + /// + /// + public global::Anthropic.BetaErrorResponseType? Type133 { get; set; } + /// + /// + /// + public global::Anthropic.Error? Type134 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInvalidRequestError? Type135 { get; set; } + /// + /// + /// + public global::Anthropic.BetaInvalidRequestErrorType? Type136 { get; set; } + /// + /// + /// + public global::Anthropic.BetaPermissionError? Type137 { get; set; } + /// + /// + /// + public global::Anthropic.BetaPermissionErrorType? Type138 { get; set; } + /// + /// + /// + public global::Anthropic.BetaNotFoundError? Type139 { get; set; } + /// + /// + /// + public global::Anthropic.BetaNotFoundErrorType? Type140 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRateLimitError? Type141 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRateLimitErrorType? Type142 { get; set; } + /// + /// + /// + public global::Anthropic.BetaOverloadedError? Type143 { get; set; } + /// + /// + /// + public global::Anthropic.BetaOverloadedErrorType? Type144 { get; set; } + /// + /// + /// + public global::Anthropic.BetaErrorResponseErrorDiscriminator? Type145 { get; set; } + /// + /// + /// + public global::Anthropic.BetaErrorResponseErrorDiscriminatorType? Type146 { get; set; } + /// + /// + /// + public global::Anthropic.BetaErroredResult? Type147 { get; set; } + /// + /// + /// + public global::Anthropic.BetaErroredResultType? Type148 { get; set; } + /// + /// + /// + public global::Anthropic.BetaExpiredResult? Type149 { get; set; } + /// + /// + /// + public global::Anthropic.BetaExpiredResultType? Type150 { get; set; } + /// + /// + /// + public global::Anthropic.BetaListResponseMessageBatch? Type151 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type152 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatch? Type153 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatchType? Type154 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatchProcessingStatus? Type155 { get; set; } + /// + /// + /// + public global::Anthropic.BetaRequestCounts? Type156 { get; set; } + /// + /// + /// + public global::System.DateTime? Type157 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessage? Type158 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageType? Type159 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageRole? Type160 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type161 { get; set; } + /// + /// + /// + public global::Anthropic.BetaContentBlock? Type162 { get; set; } + /// + /// + /// + public global::Anthropic.BetaContentBlockDiscriminator? Type163 { get; set; } + /// + /// + /// + public global::Anthropic.BetaContentBlockDiscriminatorType? Type164 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStopReason? Type165 { get; set; } + /// + /// + /// + public global::Anthropic.BetaUsage? Type166 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatchIndividualResponse? Type167 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatchResult? Type168 { get; set; } + /// + /// + /// + public global::Anthropic.BetaSucceededResult? Type169 { get; set; } + /// + /// + /// + public global::Anthropic.BetaSucceededResultType? Type170 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatchResultDiscriminator? Type171 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageBatchResultDiscriminatorType? Type172 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageDelta? Type173 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageDeltaStopReason? Type174 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageDeltaEvent? Type175 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageDeltaEventType? Type176 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageDeltaUsage? Type177 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStartEvent? Type178 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStartEventType? Type179 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStopEvent? Type180 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStopEventType? Type181 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStreamEvent? Type182 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStreamEventDiscriminator? Type183 { get; set; } + /// + /// + /// + public global::Anthropic.BetaMessageStreamEventDiscriminatorType? Type184 { get; set; } + /// + /// + /// + public global::Anthropic.CacheControlEphemeral? Type185 { get; set; } + /// + /// + /// + public global::Anthropic.CacheControlEphemeralType? Type186 { get; set; } + /// + /// + /// + public global::Anthropic.CompletionRequest? Type187 { get; set; } + /// + /// + /// + public global::Anthropic.Metadata? Type188 { get; set; } + /// + /// + /// + public global::Anthropic.CompletionResponse? Type189 { get; set; } + /// + /// + /// + public global::Anthropic.CompletionResponseType? Type190 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockDeltaEvent? Type191 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockDeltaEventType? Type192 { get; set; } + /// + /// + /// + public global::Anthropic.Delta2? Type193 { get; set; } + /// + /// + /// + public global::Anthropic.TextContentBlockDelta? Type194 { get; set; } + /// + /// + /// + public global::Anthropic.TextContentBlockDeltaType? Type195 { get; set; } + /// + /// + /// + public global::Anthropic.InputJsonContentBlockDelta? Type196 { get; set; } + /// + /// + /// + public global::Anthropic.InputJsonContentBlockDeltaType? Type197 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockDeltaEventDeltaDiscriminator? Type198 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockDeltaEventDeltaDiscriminatorType? Type199 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockStartEvent? Type200 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockStartEventType? Type201 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlock2? Type202 { get; set; } + /// + /// + /// + public global::Anthropic.ResponseTextBlock? Type203 { get; set; } + /// + /// + /// + public global::Anthropic.ResponseTextBlockType? Type204 { get; set; } + /// + /// + /// + public global::Anthropic.ResponseToolUseBlock? Type205 { get; set; } + /// + /// + /// + public global::Anthropic.ResponseToolUseBlockType? Type206 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockStartEventContentBlockDiscriminator? Type207 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockStartEventContentBlockDiscriminatorType? Type208 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockStopEvent? Type209 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockStopEventType? Type210 { get; set; } + /// + /// + /// + public global::Anthropic.CreateMessageParams? Type211 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type212 { get; set; } + /// + /// + /// + public global::Anthropic.InputMessage? Type213 { get; set; } + /// + /// + /// + public global::Anthropic.InputMessageRole? Type214 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type215 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type216 { get; set; } + /// + /// + /// + public global::Anthropic.ContentVariant2Item2? Type217 { get; set; } + /// + /// + /// + public global::Anthropic.RequestTextBlock? Type218 { get; set; } + /// + /// + /// + public global::Anthropic.RequestTextBlockType? Type219 { get; set; } + /// + /// + /// + public global::Anthropic.RequestImageBlock? Type220 { get; set; } + /// + /// + /// + public global::Anthropic.RequestImageBlockType? Type221 { get; set; } + /// + /// + /// + public global::Anthropic.RequestImageBlockSourceDiscriminator? Type222 { get; set; } + /// + /// + /// + public global::Anthropic.RequestImageBlockSourceDiscriminatorType? Type223 { get; set; } + /// + /// + /// + public global::Anthropic.RequestToolUseBlock? Type224 { get; set; } + /// + /// + /// + public global::Anthropic.RequestToolUseBlockType? Type225 { get; set; } + /// + /// + /// + public global::Anthropic.RequestToolResultBlock? Type226 { get; set; } + /// + /// + /// + public global::Anthropic.RequestToolResultBlockType? Type227 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type228 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type229 { get; set; } + /// + /// + /// + public global::Anthropic.ContentVariant2Item5? Type230 { get; set; } + /// + /// + /// + public global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminator? Type231 { get; set; } + /// + /// + /// + public global::Anthropic.RequestToolResultBlockContentVariant2ItemDiscriminatorType? Type232 { get; set; } + /// + /// + /// + public global::Anthropic.InputMessageContentVariant2ItemDiscriminator? Type233 { get; set; } + /// + /// + /// + public global::Anthropic.InputMessageContentVariant2ItemDiscriminatorType? Type234 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type235 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type236 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoice? Type237 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceAuto? Type238 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceAutoType? Type239 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceAny? Type240 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceAnyType? Type241 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceTool? Type242 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceToolType? Type243 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceDiscriminator? Type244 { get; set; } + /// + /// + /// + public global::Anthropic.ToolChoiceDiscriminatorType? Type245 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type246 { get; set; } + /// + /// + /// + public global::Anthropic.Tool? Type247 { get; set; } + /// + /// + /// + public global::Anthropic.InputSchema? Type248 { get; set; } + /// + /// + /// + public global::Anthropic.InputSchemaType? Type249 { get; set; } + /// + /// + /// + public global::Anthropic.ErrorResponse? Type250 { get; set; } + /// + /// + /// + public global::Anthropic.ErrorResponseType? Type251 { get; set; } + /// + /// + /// + public global::Anthropic.Error2? Type252 { get; set; } + /// + /// + /// + public global::Anthropic.InvalidRequestError? Type253 { get; set; } + /// + /// + /// + public global::Anthropic.InvalidRequestErrorType? Type254 { get; set; } + /// + /// + /// + public global::Anthropic.PermissionError? Type255 { get; set; } + /// + /// + /// + public global::Anthropic.PermissionErrorType? Type256 { get; set; } + /// + /// + /// + public global::Anthropic.NotFoundError? Type257 { get; set; } + /// + /// + /// + public global::Anthropic.NotFoundErrorType? Type258 { get; set; } + /// + /// + /// + public global::Anthropic.RateLimitError? Type259 { get; set; } + /// + /// + /// + public global::Anthropic.RateLimitErrorType? Type260 { get; set; } + /// + /// + /// + public global::Anthropic.OverloadedError? Type261 { get; set; } + /// + /// + /// + public global::Anthropic.OverloadedErrorType? Type262 { get; set; } + /// + /// + /// + public global::Anthropic.ErrorResponseErrorDiscriminator? Type263 { get; set; } + /// + /// + /// + public global::Anthropic.ErrorResponseErrorDiscriminatorType? Type264 { get; set; } + /// + /// + /// + public global::Anthropic.Message? Type265 { get; set; } + /// + /// + /// + public global::Anthropic.MessageType? Type266 { get; set; } + /// + /// + /// + public global::Anthropic.MessageRole? Type267 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type268 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlock3? Type269 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockDiscriminator? Type270 { get; set; } + /// + /// + /// + public global::Anthropic.ContentBlockDiscriminatorType? Type271 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStopReason? Type272 { get; set; } + /// + /// + /// + public global::Anthropic.Usage? Type273 { get; set; } + /// + /// + /// + public global::Anthropic.MessageDelta? Type274 { get; set; } + /// + /// + /// + public global::Anthropic.MessageDeltaStopReason? Type275 { get; set; } + /// + /// + /// + public global::Anthropic.MessageDeltaEvent? Type276 { get; set; } + /// + /// + /// + public global::Anthropic.MessageDeltaEventType? Type277 { get; set; } + /// + /// + /// + public global::Anthropic.MessageDeltaUsage? Type278 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStartEvent? Type279 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStartEventType? Type280 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStopEvent? Type281 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStopEventType? Type282 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStreamEvent? Type283 { get; set; } + /// + /// + /// + public global::Anthropic.Ping? Type284 { get; set; } + /// + /// + /// + public global::Anthropic.PingType? Type285 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStreamEventDiscriminator? Type286 { get; set; } + /// + /// + /// + public global::Anthropic.MessageStreamEventDiscriminatorType? Type287 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaCreateMessageParams? Type288 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type289 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaInputMessage? Type290 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaInputMessageRole? Type291 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type292 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type293 { get; set; } + /// + /// + /// + public global::Anthropic.ContentVariant2Item3? Type294 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestTextBlock? Type295 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminator? Type296 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestTextBlockCacheControlDiscriminatorType? Type297 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestTextBlockType? Type298 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestImageBlock? Type299 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminator? Type300 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestImageBlockCacheControlDiscriminatorType? Type301 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestImageBlockType? Type302 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminator? Type303 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestImageBlockSourceDiscriminatorType? Type304 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolUseBlock? Type305 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminator? Type306 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolUseBlockCacheControlDiscriminatorType? Type307 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolUseBlockType? Type308 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolResultBlock? Type309 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminator? Type310 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolResultBlockCacheControlDiscriminatorType? Type311 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolResultBlockType? Type312 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type313 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type314 { get; set; } + /// + /// + /// + public global::Anthropic.ContentVariant2Item4? Type315 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminator? Type316 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaRequestToolResultBlockContentVariant2ItemDiscriminatorType? Type317 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminator? Type318 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaInputMessageContentVariant2ItemDiscriminatorType? Type319 { get; set; } + /// + /// + /// + public global::Anthropic.AnyOf>? Type320 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type321 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type322 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaTool? Type323 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaToolCacheControlDiscriminator? Type324 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaToolCacheControlDiscriminatorType? Type325 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessage? Type326 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageType? Type327 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageRole? Type328 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageStopReason? Type329 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaUsage? Type330 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageStartEvent? Type331 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageStartEventType? Type332 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageStreamEvent? Type333 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminator? Type334 { get; set; } + /// + /// + /// + public global::Anthropic.PromptCachingBetaMessageStreamEventDiscriminatorType? Type335 { get; set; } + /// + /// + /// + public global::Anthropic.CreateMessageParamsWithoutStream? Type336 { get; set; } + /// + /// + /// + public global::Anthropic.AnthropicBeta? Type337 { get; set; } + /// + /// + /// + public global::Anthropic.AnthropicBetaEnum? Type338 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Anthropic/InputMessage.cs b/src/libs/Anthropic/InputMessage.cs new file mode 100644 index 0000000..1b17b5d --- /dev/null +++ b/src/libs/Anthropic/InputMessage.cs @@ -0,0 +1,68 @@ +namespace Anthropic; + +public partial class InputMessage +{ + /// + /// + /// + /// + /// + public static implicit operator InputMessage(string content) + { + return ToInputMessage(content); + } + + /// + /// + /// + /// + /// + public static InputMessage ToInputMessage(string content) + { + return new InputMessage + { + Role = InputMessageRole.User, + Content = content, + }; + } + + /// + /// Returns the message content as a simple text. + /// + /// + public string AsSimpleText() + { + if (Content.IsValue1) + { + return Content.Value1!; + } + if (Content.IsValue2) + { + return string.Join(Environment.NewLine, Content.Value2! + .Select(x => + { + if (x.IsText) + { + return x.Text!.Text; + } + if (x.IsImage) + { + return "Image"; + //return x.Image!.Source.Data; + } + if (x.IsToolUse) + { + return x.ToolUse!.Name; + } + if (x.IsToolResult) + { + return x.ToolResult!.ToolUseId; + } + + return string.Empty; + })); + } + + return string.Empty; + } +} \ No newline at end of file diff --git a/src/libs/Anthropic/Message.cs b/src/libs/Anthropic/Message.cs index 36803de..230b27c 100644 --- a/src/libs/Anthropic/Message.cs +++ b/src/libs/Anthropic/Message.cs @@ -2,66 +2,25 @@ namespace Anthropic; public partial class Message { - /// - /// - /// - /// - /// - public static implicit operator Message(string content) - { - return ToMessage(content); - } - - /// - /// - /// - /// - /// - public static Message ToMessage(string content) - { - return new Message - { - Role = MessageRole.User, - Content = content, - }; - } - /// /// Returns the message content as a simple text. /// /// public string AsSimpleText() { - if (Content.IsValue1) - { - return Content.Value1!; - } - if (Content.IsValue2) - { - return string.Join(Environment.NewLine, Content.Value2! - .Select(x => + return string.Join(Environment.NewLine, Content + .Select(x => + { + if (x.IsText) + { + return x.Text!.Text; + } + if (x.IsToolUse) { - if (x.IsText) - { - return x.Text!.Text; - } - if (x.IsImage) - { - return x.Image!.Source.Data; - } - if (x.IsToolUse) - { - return x.ToolUse!.Name; - } - if (x.IsToolResult) - { - return x.ToolResult!.ToolUseId; - } - - return string.Empty; - })); - } - - return string.Empty; + return x.ToolUse!.Name; + } + + return string.Empty; + })); } } \ No newline at end of file diff --git a/src/libs/Anthropic/Metadata/Metadata.Chat.cs b/src/libs/Anthropic/Metadata/Metadata.Chat.cs index cf3a141..544460f 100644 --- a/src/libs/Anthropic/Metadata/Metadata.Chat.cs +++ b/src/libs/Anthropic/Metadata/Metadata.Chat.cs @@ -1,65 +1,78 @@ // ReSharper disable once CheckNamespace namespace Anthropic; -public static partial class Metadata +public static partial class ModelMetadata { /// - /// According https://openai.com/pricing/
+ /// According https://anthropic.com/pricing#anthropic-api
///
/// /// public static ChatModelMetadata GetChatModelMetadata( - this CreateMessageRequestModel model) + this ModelEnum model) { return model switch { - CreateMessageRequestModel.ClaudeInstant12 => new ChatModelMetadata + ModelEnum.ClaudeInstant12 => new ChatModelMetadata { PricePerInputTokenInUsd = 0.80 * UsdPerMillionTokens, PricePerOutputTokenInUsd = 2.40 * UsdPerMillionTokens, ContextLength = 100_000, }, - CreateMessageRequestModel.Claude20 => new ChatModelMetadata + ModelEnum.Claude20 => new ChatModelMetadata { PricePerInputTokenInUsd = 8.00 * UsdPerMillionTokens, PricePerOutputTokenInUsd = 24.00 * UsdPerMillionTokens, ContextLength = 100_000, }, - CreateMessageRequestModel.Claude21 => new ChatModelMetadata + ModelEnum.Claude21 => new ChatModelMetadata { PricePerInputTokenInUsd = 8.00 * UsdPerMillionTokens, PricePerOutputTokenInUsd = 24.00 * UsdPerMillionTokens, ContextLength = 200_000, }, - CreateMessageRequestModel.Claude3Sonnet20240229 => new ChatModelMetadata + ModelEnum.Claude3Sonnet20240229 => new ChatModelMetadata { PricePerInputTokenInUsd = 3.00 * UsdPerMillionTokens, PricePerOutputTokenInUsd = 15.00 * UsdPerMillionTokens, ContextLength = 200_000, OutputLength = 4_096, }, - - CreateMessageRequestModel.Claude3Opus20240229 => new ChatModelMetadata + ModelEnum.Claude3Haiku20240307 or + ModelEnum.Claude3Haiku20241022 => new ChatModelMetadata { - PricePerInputTokenInUsd = 15.00 * UsdPerMillionTokens, - PricePerOutputTokenInUsd = 75.00 * UsdPerMillionTokens, + PricePerInputTokenInUsd = 0.25 * UsdPerMillionTokens, + PricePerOutputTokenInUsd = 1.25 * UsdPerMillionTokens, ContextLength = 200_000, OutputLength = 4_096, }, - CreateMessageRequestModel.Claude3Haiku20240307 => new ChatModelMetadata + ModelEnum.Claude3OpusLatest or + ModelEnum.Claude3Opus20240229 => new ChatModelMetadata + { + PricePerInputTokenInUsd = 15.00 * UsdPerMillionTokens, + PricePerOutputTokenInUsd = 75.00 * UsdPerMillionTokens, + ContextLength = 200_000, + OutputLength = 4_096, + }, + + ModelEnum.Claude35SonnetLatest or + ModelEnum.Claude35Sonnet20240620 or + ModelEnum.Claude35Sonnet20241022 => new ChatModelMetadata { - PricePerInputTokenInUsd = 0.25 * UsdPerMillionTokens, - PricePerOutputTokenInUsd = 1.25 * UsdPerMillionTokens, + PricePerInputTokenInUsd = 3.00 * UsdPerMillionTokens, + PricePerOutputTokenInUsd = 15.00 * UsdPerMillionTokens, ContextLength = 200_000, + // https://docs.anthropic.com/en/docs/about-claude/models + // 8192 output tokens is in beta and requires the header anthropic-beta: max-tokens-3-5-sonnet-2024-07-15. If the header is not specified, the limit is 4096 tokens. OutputLength = 4_096, }, - CreateMessageRequestModel.Claude35Sonnet20240620 => new ChatModelMetadata + ModelEnum.Claude35HaikuLatest => new ChatModelMetadata { - PricePerInputTokenInUsd = 3.00 * UsdPerMillionTokens, - PricePerOutputTokenInUsd = 15.00 * UsdPerMillionTokens, + PricePerInputTokenInUsd = 0.80 * UsdPerMillionTokens, + PricePerOutputTokenInUsd = 4.00 * UsdPerMillionTokens, ContextLength = 200_000, // https://docs.anthropic.com/en/docs/about-claude/models // 8192 output tokens is in beta and requires the header anthropic-beta: max-tokens-3-5-sonnet-2024-07-15. If the header is not specified, the limit is 4096 tokens. @@ -78,7 +91,7 @@ public static ChatModelMetadata GetChatModelMetadata( /// /// public static double? TryGetPriceInUsd( - this CreateMessageRequestModel model, + this ModelEnum model, int inputTokens, int outputTokens) { @@ -94,10 +107,10 @@ public static ChatModelMetadata GetChatModelMetadata( outputTokens * metadata.PricePerOutputTokenInUsd; } - /// + /// /// public static double GetPriceInUsd( - this CreateMessageRequestModel model, + this ModelEnum model, int inputTokens, int outputTokens) { @@ -109,7 +122,7 @@ public static double GetPriceInUsd( /// /// public static int GetContextLength( - this CreateMessageRequestModel model) + this ModelEnum model) { return model.GetChatModelMetadata().ContextLength ?? throw new InvalidOperationException( @@ -119,7 +132,7 @@ public static int GetContextLength( /// /// public static int GetOutputLength( - this CreateMessageRequestModel model) + this ModelEnum model) { return model.GetChatModelMetadata().OutputLength ?? throw new InvalidOperationException( diff --git a/src/libs/Anthropic/Metadata/Metadata.cs b/src/libs/Anthropic/Metadata/Metadata.cs index be8d0e5..92f7cad 100644 --- a/src/libs/Anthropic/Metadata/Metadata.cs +++ b/src/libs/Anthropic/Metadata/Metadata.cs @@ -2,9 +2,9 @@ namespace Anthropic; /// -/// According https://openai.com/pricing/ +/// According https://anthropic.com/pricing#anthropic-api /// -public static partial class Metadata +public static partial class ModelMetadata { /// /// Just a constant for 1e-3. diff --git a/src/libs/Anthropic/generate.sh b/src/libs/Anthropic/generate.sh index 408e0d7..5393945 100755 --- a/src/libs/Anthropic/generate.sh +++ b/src/libs/Anthropic/generate.sh @@ -1,6 +1,10 @@ dotnet tool install --global autosdk.cli --prerelease rm -rf Generated -curl -o openapi.yaml https://raw.githubusercontent.com/davidmigloz/langchain_dart/main/packages/anthropic_sdk_dart/oas/anthropic_openapi_curated.yaml +curl -o .stats.yml https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/refs/heads/main/.stats.yml +openapi_spec_url=$(sed -n 's/^openapi_spec_url: //p' .stats.yml) +echo "OpenAPI spec URL: $openapi_spec_url" +rm .stats.yml +curl -o openapi.yaml $openapi_spec_url dotnet run --project ../../helpers/FixOpenApiSpec openapi.yaml if [ $? -ne 0 ]; then echo "Failed, exiting..." diff --git a/src/libs/Anthropic/openapi.yaml b/src/libs/Anthropic/openapi.yaml index 498ed62..133201c 100644 --- a/src/libs/Anthropic/openapi.yaml +++ b/src/libs/Anthropic/openapi.yaml @@ -1,75 +1,2559 @@ openapi: 3.0.1 info: title: Anthropic API - description: API Spec for Anthropic API. Please see https://docs.anthropic.com/en/api for more details. - version: '1' + version: 0.0.0 servers: - - url: https://api.anthropic.com/v1 + - url: https://api.anthropic.com paths: - /messages: + /v1/messages: post: tags: - Messages summary: Create a Message - description: "Send a structured list of input messages with text and/or image content, and the\nmodel will generate the next message in the conversation.\n\nThe Messages API can be used for either single queries or stateless multi-turn\nconversations.\n" - operationId: createMessage + description: "Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.\n\nThe Messages API can be used for either single queries or stateless multi-turn conversations." + operationId: messages_post + parameters: + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." requestBody: content: application/json: schema: - $ref: '#/components/schemas/CreateMessageRequest' + $ref: '#/components/schemas/CreateMessageParams' required: true responses: '200': - description: OK + description: Message object. content: application/json: schema: $ref: '#/components/schemas/Message' - /messages/batches: + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/complete: + post: + tags: + - Text Completions + summary: Create a Text Completion + description: "[Legacy] Create a Text Completion.\n\nThe Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.anthropic.com/en/api/messages) going forward.\n\nFuture models and features will not be compatible with Text Completions. See our [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages." + operationId: complete_post + parameters: + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CompletionRequest' + required: true + responses: + '200': + description: Text Completion object. + content: + application/json: + schema: + $ref: '#/components/schemas/CompletionResponse' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/messages?beta=true: post: tags: - Messages + summary: Create a Message + description: "Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.\n\nThe Messages API can be used for either single queries or stateless multi-turn conversations." + operationId: beta_messages_post + parameters: + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateMessageParams' + required: true + responses: + '200': + description: Message object. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessage' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + /v1/messages/batches?beta=true: + post: + tags: + - Message Batches summary: Create a Message Batch - description: Send a batch of Message creation requests. - operationId: createMessageBatch + description: "Send a batch of Message creation requests.\n\nThe Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete." + operationId: beta_message_batches_post + parameters: + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." requestBody: content: application/json: schema: - $ref: '#/components/schemas/CreateMessageBatchRequest' + $ref: '#/components/schemas/BetaCreateMessageBatchParams' required: true responses: '200': - description: OK + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + get: + tags: + - Message Batches + summary: List Message Batches + description: List all Message Batches within a Workspace. Most recently created batches are returned first. + operationId: beta_message_batches_list + parameters: + - name: before_id + in: query + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.' + schema: + title: Before Id + type: string + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.' + - name: after_id + in: query + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.' + schema: + title: After Id + type: string + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.' + - name: limit + in: query + description: "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `100`." + schema: + title: Limit + maximum: 100 + minimum: 1 + type: integer + description: "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `100`." + default: 20 + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + - name: x-api-key + in: header + description: "Your unique API key for authentication. \n\nThis 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." + schema: + title: X-Api-Key + type: string + description: "Your unique API key for authentication. \n\nThis 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." + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaListResponse_MessageBatch_' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + '/v1/messages/batches/{message_batch_id}?beta=true': + get: + tags: + - Message Batches + summary: Retrieve a Message Batch + description: 'This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.' + operationId: beta_message_batches_retrieve + parameters: + - name: message_batch_id + in: path + description: ID of the Message Batch. + required: true + schema: + title: Message Batch Id + type: string + description: ID of the Message Batch. + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + - name: x-api-key + in: header + description: "Your unique API key for authentication. \n\nThis 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." + schema: + title: X-Api-Key + type: string + description: "Your unique API key for authentication. \n\nThis 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." + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + '/v1/messages/batches/{message_batch_id}/cancel?beta=true': + post: + tags: + - Message Batches + summary: Cancel a Message Batch + description: "Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.\n\nThe number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible." + operationId: beta_message_batches_cancel + parameters: + - name: message_batch_id + in: path + description: ID of the Message Batch. + required: true + schema: + title: Message Batch Id + type: string + description: ID of the Message Batch. + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." content: application/json: schema: - $ref: '#/components/schemas/MessageBatch' - '/messages/batches/{id}': + $ref: '#/components/schemas/BetaErrorResponse' + '/v1/messages/batches/{message_batch_id}/results?beta=true': get: + tags: + - Message Batches + summary: Retrieve Message Batch results + description: "Streams the results of a Message Batch as a `.jsonl` file.\n\nEach line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests." + operationId: beta_message_batches_results + parameters: + - name: message_batch_id + in: path + description: ID of the Message Batch. + required: true + schema: + title: Message Batch Id + type: string + description: ID of the Message Batch. + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + - name: x-api-key + in: header + description: "Your unique API key for authentication. \n\nThis 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." + schema: + title: X-Api-Key + type: string + description: "Your unique API key for authentication. \n\nThis 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." + responses: + '200': + description: Successful Response + content: + application/x-jsonl: + schema: + type: string + format: binary + x-line-schema: + $ref: '#/components/schemas/BetaMessageBatchIndividualResponse' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + /v1/messages/count_tokens?beta=true: + post: + tags: + - Messages + summary: Count tokens in a Message + description: "Count the number of tokens in a Message.\n\nThe Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it." + operationId: beta_messages_count_tokens_post + parameters: + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCountMessageTokensParams' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCountMessageTokensResponse' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + /v1/messages?beta=prompt_caching: + post: tags: - Messages + summary: Create a Message + description: "Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.\n\nThe Messages API can be used for either single queries or stateless multi-turn conversations." + operationId: prompt_caching_beta_messages_post + parameters: + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PromptCachingBetaCreateMessageParams' + required: true + responses: + '200': + description: Message object. + content: + application/json: + schema: + $ref: '#/components/schemas/PromptCachingBetaMessage' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/messages/batches: + post: + tags: + - Message Batches + summary: Create a Message Batch + description: "Send a batch of Message creation requests.\n\nThe Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete." + operationId: beta_message_batches_post + parameters: + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateMessageBatchParams' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + get: + tags: + - Message Batches + summary: List Message Batches + description: List all Message Batches within a Workspace. Most recently created batches are returned first. + operationId: beta_message_batches_list + parameters: + - name: before_id + in: query + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.' + schema: + title: Before Id + type: string + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.' + - name: after_id + in: query + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.' + schema: + title: After Id + type: string + description: 'ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.' + - name: limit + in: query + description: "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `100`." + schema: + title: Limit + maximum: 100 + minimum: 1 + type: integer + description: "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `100`." + default: 20 + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + - name: x-api-key + in: header + description: "Your unique API key for authentication. \n\nThis 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." + schema: + title: X-Api-Key + type: string + description: "Your unique API key for authentication. \n\nThis 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." + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaListResponse_MessageBatch_' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + '/v1/messages/batches/{message_batch_id}': + get: + tags: + - Message Batches summary: Retrieve a Message Batch - description: "This endpoint is idempotent and can be used to poll for Message Batch\ncompletion. To access the results of a Message Batch, make a request to the\n`results_url` field in the response.\n" - operationId: retrieveMessageBatch + description: 'This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.' + operationId: beta_message_batches_retrieve parameters: - - name: id + - name: message_batch_id in: path - description: The ID of the message batch to retrieve. + description: ID of the Message Batch. required: true schema: + title: Message Batch Id + type: string + description: ID of the Message Batch. + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + - name: x-api-key + in: header + description: "Your unique API key for authentication. \n\nThis 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." + schema: + title: X-Api-Key type: string + description: "Your unique API key for authentication. \n\nThis 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." responses: '200': - description: OK + description: Successful Response content: application/json: schema: - $ref: '#/components/schemas/MessageBatch' -components: - schemas: - CreateMessageRequest: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + '/v1/messages/batches/{message_batch_id}/cancel': + post: + tags: + - Message Batches + summary: Cancel a Message Batch + description: "Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.\n\nThe number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible." + operationId: beta_message_batches_cancel + parameters: + - name: message_batch_id + in: path + description: ID of the Message Batch. + required: true + schema: + title: Message Batch Id + type: string + description: ID of the Message Batch. + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + '/v1/messages/batches/{message_batch_id}/results': + get: + tags: + - Message Batches + summary: Retrieve Message Batch results + description: "Streams the results of a Message Batch as a `.jsonl` file.\n\nEach line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests." + operationId: beta_message_batches_results + parameters: + - name: message_batch_id + in: path + description: ID of the Message Batch. + required: true + schema: + title: Message Batch Id + type: string + description: ID of the Message Batch. + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + - name: x-api-key + in: header + description: "Your unique API key for authentication. \n\nThis 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." + schema: + title: X-Api-Key + type: string + description: "Your unique API key for authentication. \n\nThis 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." + responses: + '200': + description: Successful Response + content: + application/x-jsonl: + schema: + type: string + format: binary + x-line-schema: + $ref: '#/components/schemas/BetaMessageBatchIndividualResponse' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + /v1/messages/count_tokens: + post: + tags: + - Messages + summary: Count tokens in a Message + description: "Count the number of tokens in a Message.\n\nThe Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it." + operationId: beta_messages_count_tokens_post + parameters: + - name: anthropic-beta + in: header + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + schema: + title: Anthropic-Beta + type: string + items: + type: string + description: "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + - name: anthropic-version + in: header + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + schema: + title: Anthropic-Version + type: string + description: "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCountMessageTokensParams' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCountMessageTokensResponse' + 4XX: + description: "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details." + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' +components: + schemas: + APIError: + title: APIError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - api_error + type: string + default: api_error + message: + title: Message + type: string + default: Internal server error + AuthenticationError: + title: AuthenticationError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - authentication_error + type: string + default: authentication_error + message: + title: Message + type: string + default: Authentication error + Base64ImageSource: + title: Base64ImageSource + required: + - type + - media_type + - data + type: object + properties: + type: + title: Type + enum: + - base64 + type: string + media_type: + title: Media Type + enum: + - image/jpeg + - image/png + - image/gif + - image/webp + type: string + data: + title: Data + type: string + format: byte + additionalProperties: false + BetaAPIError: + title: APIError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - api_error + type: string + default: api_error + message: + title: Message + type: string + default: Internal server error + BetaAuthenticationError: + title: AuthenticationError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - authentication_error + type: string + default: authentication_error + message: + title: Message + type: string + default: Authentication error + BetaBase64ImageSource: + title: Base64ImageSource + required: + - type + - media_type + - data + type: object + properties: + type: + title: Type + enum: + - base64 + type: string + media_type: + title: Media Type + enum: + - image/jpeg + - image/png + - image/gif + - image/webp + type: string + data: + title: Data + type: string + format: byte + additionalProperties: false + BetaBase64PDFSource: + title: Base64PDFSource + required: + - type + - media_type + - data + type: object + properties: + type: + title: Type + enum: + - base64 + type: string + media_type: + title: Media Type + enum: + - application/pdf + type: string + data: + title: Data + type: string + format: byte + additionalProperties: false + BetaBashTool_20241022: + title: BashTool_20241022 + required: + - type + - name + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - bash_20241022 + type: string + name: + title: Name + enum: + - bash + type: string + description: "Name of the tool.\n\nThis is how the tool will be called by the model and in tool_use blocks." + additionalProperties: false + BetaCacheControlEphemeral: + title: CacheControlEphemeral + required: + - type + type: object + properties: + type: + title: Type + enum: + - ephemeral + type: string + additionalProperties: false + BetaCanceledResult: + title: CanceledResult + required: + - type + type: object + properties: + type: + title: Type + enum: + - canceled + type: string + default: canceled + BetaComputerUseTool_20241022: + title: ComputerUseTool_20241022 + required: + - type + - name + - display_height_px + - display_width_px + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - computer_20241022 + type: string + name: + title: Name + enum: + - computer + type: string + description: "Name of the tool.\n\nThis is how the tool will be called by the model and in tool_use blocks." + display_height_px: + title: Display Height Px + minimum: 1 + type: integer + description: The height of the display in pixels. + display_width_px: + title: Display Width Px + minimum: 1 + type: integer + description: The width of the display in pixels. + display_number: + title: Display Number + minimum: 0 + type: integer + description: 'The X11 display number (e.g. 0, 1) for the display.' + nullable: true + additionalProperties: false + BetaContentBlockDeltaEvent: + title: ContentBlockDeltaEvent + required: + - type + - index + - delta + type: object + properties: + type: + title: Type + enum: + - content_block_delta + type: string + default: content_block_delta + index: + title: Index + type: integer + delta: + title: Delta + oneOf: + - $ref: '#/components/schemas/BetaTextContentBlockDelta' + - $ref: '#/components/schemas/BetaInputJsonContentBlockDelta' + discriminator: + propertyName: type + mapping: + input_json_delta: '#/components/schemas/BetaInputJsonContentBlockDelta' + text_delta: '#/components/schemas/BetaTextContentBlockDelta' + BetaContentBlockStartEvent: + title: ContentBlockStartEvent + required: + - type + - index + - content_block + type: object + properties: + type: + title: Type + enum: + - content_block_start + type: string + default: content_block_start + index: + title: Index + type: integer + content_block: + title: Content Block + oneOf: + - $ref: '#/components/schemas/BetaResponseTextBlock' + - $ref: '#/components/schemas/BetaResponseToolUseBlock' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/BetaResponseTextBlock' + tool_use: '#/components/schemas/BetaResponseToolUseBlock' + BetaContentBlockStopEvent: + title: ContentBlockStopEvent + required: + - type + - index + type: object + properties: + type: + title: Type + enum: + - content_block_stop + type: string + default: content_block_stop + index: + title: Index + type: integer + BetaCountMessageTokensParams: + title: CountMessageTokensParams + required: + - messages + - model + type: object + properties: + tool_choice: + $ref: '#/components/schemas/BetaToolChoice' + tools: + title: Tools + type: array + items: + oneOf: + - $ref: '#/components/schemas/BetaTool' + - $ref: '#/components/schemas/BetaComputerUseTool_20241022' + - $ref: '#/components/schemas/BetaBashTool_20241022' + - $ref: '#/components/schemas/BetaTextEditor_20241022' + description: "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details." + example: + description: Get the current weather in a given location + input_schema: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + name: get_weather + messages: + title: Messages + type: array + items: + $ref: '#/components/schemas/BetaInputMessage' + description: "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nStarting with Claude 3 models, you can also send image content blocks:\n\n```json\n{\"role\": \"user\", \"content\": [\n {\n \"type\": \"image\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"image/jpeg\",\n \"data\": \"/9j/4AAQSkZJRg...\",\n }\n },\n {\"type\": \"text\", \"text\": \"What is in this image?\"}\n]}\n```\n\nWe currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.\n\nSee [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.\n\nNote that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API." + system: + title: System + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/BetaRequestTextBlock' + description: "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts)." + example: + - text: Today's date is 2024-06-01. + type: text + model: + $ref: '#/components/schemas/Model' + additionalProperties: false + example: + messages: + - content: 'Hello, world' + role: user + model: claude-3-5-sonnet-20241022 + BetaCountMessageTokensResponse: + title: CountMessageTokensResponse + required: + - input_tokens + type: object + properties: + input_tokens: + title: Input Tokens + type: integer + description: 'The total number of tokens across the provided list of messages, system prompt, and tools.' + example: 2095 + example: + input_tokens: 2095 + BetaCreateMessageBatchParams: + title: CreateMessageBatchParams + required: + - requests + type: object + properties: + requests: + title: Requests + type: array + items: + $ref: '#/components/schemas/BetaMessageBatchIndividualRequestParams' + description: List of requests for prompt completion. Each is an individual request to create a Message. + additionalProperties: false + BetaCreateMessageParams: + title: CreateMessageParams + required: + - model + - messages + - max_tokens + type: object + properties: + model: + $ref: '#/components/schemas/Model' + messages: + title: Messages + type: array + items: + $ref: '#/components/schemas/BetaInputMessage' + description: "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nStarting with Claude 3 models, you can also send image content blocks:\n\n```json\n{\"role\": \"user\", \"content\": [\n {\n \"type\": \"image\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"image/jpeg\",\n \"data\": \"/9j/4AAQSkZJRg...\",\n }\n },\n {\"type\": \"text\", \"text\": \"What is in this image?\"}\n]}\n```\n\nWe currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.\n\nSee [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.\n\nNote that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API." + max_tokens: + title: Max Tokens + minimum: 1 + type: integer + description: "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details." + example: 1024 + metadata: + allOf: + - $ref: '#/components/schemas/BetaMetadata' + description: An object describing metadata about the request. + stop_sequences: + title: Stop Sequences + type: array + items: + type: string + description: "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + stream: + title: Stream + type: boolean + description: "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details." + system: + title: System + anyOf: + - type: string + x-stainless-skip: + - go + - type: array + items: + $ref: '#/components/schemas/BetaRequestTextBlock' + description: "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts)." + example: + - text: Today's date is 2024-06-01. + type: text + temperature: + title: Temperature + maximum: 1 + minimum: 0 + type: number + description: "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + example: 1 + tool_choice: + $ref: '#/components/schemas/BetaToolChoice' + tools: + title: Tools + type: array + items: + oneOf: + - $ref: '#/components/schemas/BetaTool' + - $ref: '#/components/schemas/BetaComputerUseTool_20241022' + - $ref: '#/components/schemas/BetaBashTool_20241022' + - $ref: '#/components/schemas/BetaTextEditor_20241022' + description: "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details." + example: + description: Get the current weather in a given location + input_schema: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + name: get_weather + top_k: + title: Top K + minimum: 0 + type: integer + description: "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 5 + top_p: + title: Top P + maximum: 1 + minimum: 0 + type: number + description: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 0.7 + additionalProperties: false + example: + max_tokens: 1024 + messages: + - content: 'Hello, world' + role: user + model: claude-3-5-sonnet-20241022 + BetaErrorResponse: + title: ErrorResponse + required: + - type + - error + type: object + properties: + type: + title: Type + enum: + - error + type: string + default: error + error: + title: Error + oneOf: + - $ref: '#/components/schemas/BetaInvalidRequestError' + - $ref: '#/components/schemas/BetaAuthenticationError' + - $ref: '#/components/schemas/BetaPermissionError' + - $ref: '#/components/schemas/BetaNotFoundError' + - $ref: '#/components/schemas/BetaRateLimitError' + - $ref: '#/components/schemas/BetaAPIError' + - $ref: '#/components/schemas/BetaOverloadedError' + discriminator: + propertyName: type + mapping: + api_error: '#/components/schemas/BetaAPIError' + authentication_error: '#/components/schemas/BetaAuthenticationError' + invalid_request_error: '#/components/schemas/BetaInvalidRequestError' + not_found_error: '#/components/schemas/BetaNotFoundError' + overloaded_error: '#/components/schemas/BetaOverloadedError' + permission_error: '#/components/schemas/BetaPermissionError' + rate_limit_error: '#/components/schemas/BetaRateLimitError' + BetaErroredResult: + title: ErroredResult + required: + - type + - error + type: object + properties: + type: + title: Type + enum: + - errored + type: string + default: errored + error: + $ref: '#/components/schemas/BetaErrorResponse' + BetaExpiredResult: + title: ExpiredResult + required: + - type + type: object + properties: + type: + title: Type + enum: + - expired + type: string + default: expired + BetaInputJsonContentBlockDelta: + title: InputJsonContentBlockDelta + required: + - type + - partial_json + type: object + properties: + type: + title: Type + enum: + - input_json_delta + type: string + default: input_json_delta + partial_json: + title: Partial Json + type: string + BetaInputMessage: + title: InputMessage + required: + - role + - content + type: object + properties: + role: + title: Role + enum: + - user + - assistant + type: string + content: + title: Content + anyOf: + - type: string + x-stainless-skip: + - go + - type: array + items: + $ref: '#/components/schemas/BetaInputContentBlock' + example: + - type: text + text: What is a quaternion? + additionalProperties: false + BetaInputSchema: + title: InputSchema + required: + - type + type: object + properties: + type: + title: Type + enum: + - object + type: string + properties: + title: Properties + type: object + nullable: true + BetaInvalidRequestError: + title: InvalidRequestError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - invalid_request_error + type: string + default: invalid_request_error + message: + title: Message + type: string + default: Invalid request + BetaListResponse_MessageBatch_: + title: 'ListResponse[MessageBatch]' + required: + - data + - has_more + - first_id + - last_id + type: object + properties: + data: + title: Data + type: array + items: + $ref: '#/components/schemas/BetaMessageBatch' + has_more: + title: Has More + type: boolean + description: Indicates if there are more results in the requested page direction. + first_id: + title: First Id + type: string + description: First ID in the `data` list. Can be used as the `before_id` for the previous page. + nullable: true + example: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + last_id: + title: Last Id + type: string + description: Last ID in the `data` list. Can be used as the `after_id` for the next page. + nullable: true + example: msgbatch_01HkcTjaV5uDC8jWR4ZsDV8d + BetaMessage: + title: Message + required: + - id + - type + - role + - content + - model + - stop_reason + - stop_sequence + - usage + type: object + properties: + id: + title: Id + type: string + description: "Unique object identifier.\n\nThe format and length of IDs may change over time." + example: msg_013Zva2CMHLNnXjNJJKqJ2EF + type: + title: Type + enum: + - message + type: string + description: "Object type.\n\nFor Messages, this is always `\"message\"`." + default: message + role: + title: Role + enum: + - assistant + type: string + description: "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`." + default: assistant + content: + title: Content + type: array + items: + $ref: '#/components/schemas/BetaContentBlock' + description: "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```" + example: + - text: Hi! My name is Claude. + type: text + model: + $ref: '#/components/schemas/Model' + stop_reason: + title: Stop Reason + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use + type: string + description: "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise." + nullable: true + stop_sequence: + title: Stop Sequence + type: string + description: "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated." + default: + nullable: true + usage: + allOf: + - $ref: '#/components/schemas/BetaUsage' + description: "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude." + example: + input_tokens: 2095 + output_tokens: 503 + example: + content: + - text: Hi! My name is Claude. + type: text + id: msg_013Zva2CMHLNnXjNJJKqJ2EF + model: claude-3-5-sonnet-20241022 + role: assistant + stop_reason: end_turn + stop_sequence: + type: message + usage: + input_tokens: 2095 + output_tokens: 503 + x-stainless-python-custom-imports: + - from .beta_content_block import BetaContentBlock as BetaContentBlock + BetaMessageBatch: + title: MessageBatch + required: + - id + - type + - processing_status + - request_counts + - ended_at + - created_at + - expires_at + - archived_at + - cancel_initiated_at + - results_url + type: object + properties: + id: + title: Id + type: string + description: "Unique object identifier.\n\nThe format and length of IDs may change over time." + example: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + type: + title: Type + enum: + - message_batch + type: string + description: "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`." + default: message_batch + processing_status: + title: Processing Status + enum: + - in_progress + - canceling + - ended + type: string + description: Processing status of the Message Batch. + request_counts: + allOf: + - $ref: '#/components/schemas/BetaRequestCounts' + description: "Tallies requests within the Message Batch, categorized by their status.\n\nRequests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch." + ended_at: + title: Ended At + type: string + description: "RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.\n\nProcessing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired." + format: date-time + nullable: true + example: '2024-08-20T18:37:24.1004350+00:00' + created_at: + title: Created At + type: string + description: RFC 3339 datetime string representing the time at which the Message Batch was created. + format: date-time + example: '2024-08-20T18:37:24.1004350+00:00' + expires_at: + title: Expires At + type: string + description: 'RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.' + format: date-time + example: '2024-08-20T18:37:24.1004350+00:00' + archived_at: + title: Archived At + type: string + description: RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + format: date-time + nullable: true + example: '2024-08-20T18:37:24.1004350+00:00' + cancel_initiated_at: + title: Cancel Initiated At + type: string + description: RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + format: date-time + nullable: true + example: '2024-08-20T18:37:24.1004350+00:00' + results_url: + title: Results Url + type: string + description: "URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.\n\nResults in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests." + nullable: true + example: https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results + BetaMessageBatchIndividualRequestParams: + title: MessageBatchIndividualRequestParams + required: + - custom_id + - params + type: object + properties: + custom_id: + title: Custom Id + maxLength: 64 + minLength: 1 + pattern: '^[a-zA-Z0-9_-]{1,64}$' + type: string + description: "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch." + example: my-custom-id-1 + params: + allOf: + - $ref: '#/components/schemas/BetaCreateMessageParams' + description: "Messages API creation parameters for the individual request. \n\nSee the [Messages API reference](/en/api/messages) for full documentation on available parameters." + additionalProperties: false + BetaMessageBatchIndividualResponse: + title: MessageBatchIndividualResponse + required: + - custom_id + - result + type: object + properties: + custom_id: + title: Custom Id + type: string + description: "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch." + example: my-custom-id-1 + result: + $ref: '#/components/schemas/BetaMessageBatchResult' + BetaMessageDelta: + title: MessageDelta + required: + - stop_reason + - stop_sequence + type: object + properties: + stop_reason: + title: Stop Reason + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use + type: string + default: + nullable: true + stop_sequence: + title: Stop Sequence + type: string + default: + nullable: true + BetaMessageDeltaEvent: + title: MessageDeltaEvent + required: + - type + - delta + - usage + type: object + properties: + type: + title: Type + enum: + - message_delta + type: string + default: message_delta + delta: + $ref: '#/components/schemas/BetaMessageDelta' + usage: + allOf: + - $ref: '#/components/schemas/BetaMessageDeltaUsage' + description: "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude." + example: + output_tokens: 503 + BetaMessageDeltaUsage: + title: MessageDeltaUsage + required: + - output_tokens + type: object + properties: + output_tokens: + title: Output Tokens + type: integer + description: The cumulative number of output tokens which were used. + example: 503 + BetaMessageStartEvent: + title: MessageStartEvent + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - message_start + type: string + default: message_start + message: + $ref: '#/components/schemas/BetaMessage' + BetaMessageStopEvent: + title: MessageStopEvent + required: + - type + type: object + properties: + type: + title: Type + enum: + - message_stop + type: string + default: message_stop + BetaMessageStreamEvent: + title: MessageStreamEvent + oneOf: + - $ref: '#/components/schemas/BetaMessageStartEvent' + - $ref: '#/components/schemas/BetaMessageDeltaEvent' + - $ref: '#/components/schemas/BetaMessageStopEvent' + - $ref: '#/components/schemas/BetaContentBlockStartEvent' + - $ref: '#/components/schemas/BetaContentBlockDeltaEvent' + - $ref: '#/components/schemas/BetaContentBlockStopEvent' + discriminator: + propertyName: type + mapping: + content_block_delta: '#/components/schemas/BetaContentBlockDeltaEvent' + content_block_start: '#/components/schemas/BetaContentBlockStartEvent' + content_block_stop: '#/components/schemas/BetaContentBlockStopEvent' + message_delta: '#/components/schemas/BetaMessageDeltaEvent' + message_start: '#/components/schemas/BetaMessageStartEvent' + message_stop: '#/components/schemas/BetaMessageStopEvent' + BetaMetadata: + title: Metadata + type: object + properties: + user_id: + title: User Id + maxLength: 256 + type: string + description: "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." + nullable: true + example: 13803d75-b4b5-4c3e-b2a2-6f21399b021b + additionalProperties: false + BetaNotFoundError: + title: NotFoundError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - not_found_error + type: string + default: not_found_error + message: + title: Message + type: string + default: Not found + BetaOverloadedError: + title: OverloadedError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - overloaded_error + type: string + default: overloaded_error + message: + title: Message + type: string + default: Overloaded + BetaPermissionError: + title: PermissionError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - permission_error + type: string + default: permission_error + message: + title: Message + type: string + default: Permission denied + BetaRateLimitError: + title: RateLimitError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - rate_limit_error + type: string + default: rate_limit_error + message: + title: Message + type: string + default: Rate limited + BetaRequestCounts: + title: RequestCounts + required: + - processing + - succeeded + - errored + - canceled + - expired + type: object + properties: + processing: + title: Processing + type: integer + description: Number of requests in the Message Batch that are processing. + default: 0 + example: 100 + succeeded: + title: Succeeded + type: integer + description: "Number of requests in the Message Batch that have completed successfully.\n\nThis is zero until processing of the entire Message Batch has ended." + default: 0 + example: 50 + errored: + title: Errored + type: integer + description: "Number of requests in the Message Batch that encountered an error.\n\nThis is zero until processing of the entire Message Batch has ended." + default: 0 + example: 30 + canceled: + title: Canceled + type: integer + description: "Number of requests in the Message Batch that have been canceled.\n\nThis is zero until processing of the entire Message Batch has ended." + default: 0 + example: 10 + expired: + title: Expired + type: integer + description: "Number of requests in the Message Batch that have expired.\n\nThis is zero until processing of the entire Message Batch has ended." + default: 0 + example: 10 + BetaRequestImageBlock: + title: RequestImageBlock + required: + - type + - source + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - image + type: string + source: + title: Source + oneOf: + - $ref: '#/components/schemas/BetaBase64ImageSource' + discriminator: + propertyName: type + mapping: + base64: '#/components/schemas/BetaBase64ImageSource' + additionalProperties: false + BetaRequestPDFBlock: + title: RequestPDFBlock + required: + - type + - source + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - document + type: string + source: + $ref: '#/components/schemas/BetaBase64PDFSource' + additionalProperties: false + BetaRequestTextBlock: + title: RequestTextBlock + required: + - type + - text + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - text + type: string + text: + title: Text + minLength: 1 + type: string + additionalProperties: false + BetaRequestToolResultBlock: + title: RequestToolResultBlock + required: + - type + - tool_use_id + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - tool_result + type: string + tool_use_id: + title: Tool Use Id + pattern: '^[a-zA-Z0-9_-]+$' + type: string + is_error: + title: Is Error + type: boolean + content: + title: Content + anyOf: + - type: string + x-stainless-skip: + - go + - type: array + items: + title: Block + oneOf: + - $ref: '#/components/schemas/BetaRequestTextBlock' + - $ref: '#/components/schemas/BetaRequestImageBlock' + discriminator: + propertyName: type + mapping: + image: '#/components/schemas/BetaRequestImageBlock' + text: '#/components/schemas/BetaRequestTextBlock' + x-stainless-naming: + python: + type_name: Content + additionalProperties: false + BetaRequestToolUseBlock: + title: RequestToolUseBlock + required: + - type + - id + - name + - input + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - tool_use + type: string + id: + title: Id + pattern: '^[a-zA-Z0-9_-]+$' + type: string + name: + title: Name + maxLength: 64 + minLength: 1 + pattern: '^[a-zA-Z0-9_-]{1,64}$' + type: string + input: + title: Input + type: object + additionalProperties: false + BetaResponseTextBlock: + title: ResponseTextBlock + required: + - type + - text + type: object + properties: + type: + title: Type + enum: + - text + type: string + default: text + text: + title: Text + maxLength: 5000000 + minLength: 0 + type: string + BetaResponseToolUseBlock: + title: ResponseToolUseBlock + required: + - type + - id + - name + - input + type: object + properties: + type: + title: Type + enum: + - tool_use + type: string + default: tool_use + id: + title: Id + pattern: '^[a-zA-Z0-9_-]+$' + type: string + name: + title: Name + minLength: 1 + type: string + input: + title: Input + type: object + BetaSucceededResult: + title: SucceededResult + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - succeeded + type: string + default: succeeded + message: + $ref: '#/components/schemas/BetaMessage' + BetaTextContentBlockDelta: + title: TextContentBlockDelta + required: + - type + - text + type: object + properties: + type: + title: Type + enum: + - text_delta + type: string + default: text_delta + text: + title: Text + type: string + BetaTextEditor_20241022: + title: TextEditor_20241022 + required: + - type + - name + type: object + properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + type: + title: Type + enum: + - text_editor_20241022 + type: string + name: + title: Name + enum: + - str_replace_editor + type: string + description: "Name of the tool.\n\nThis is how the tool will be called by the model and in tool_use blocks." + additionalProperties: false + BetaTool: + title: Tool + required: + - name + - input_schema + type: object + properties: + type: + title: Type + enum: + - custom + type: string + nullable: true + description: + title: Description + type: string + description: "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema." + example: Get the current weather in a given location + name: + title: Name + maxLength: 64 + minLength: 1 + pattern: '^[a-zA-Z0-9_-]{1,64}$' + type: string + description: "Name of the tool.\n\nThis is how the tool will be called by the model and in tool_use blocks." + input_schema: + allOf: + - $ref: '#/components/schemas/BetaInputSchema' + description: "[JSON schema](https://json-schema.org/) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce." + example: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + additionalProperties: false + BetaToolChoiceAny: + title: ToolChoiceAny + required: + - type + type: object + properties: + type: + title: Type + enum: + - any + type: string + disable_parallel_tool_use: + title: Disable Parallel Tool Use + type: boolean + description: "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + additionalProperties: false + description: The model will use any available tools. + BetaToolChoiceAuto: + title: ToolChoiceAuto + required: + - type + type: object + properties: + type: + title: Type + enum: + - auto + type: string + disable_parallel_tool_use: + title: Disable Parallel Tool Use + type: boolean + description: "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use." + additionalProperties: false + description: The model will automatically decide whether to use tools. + BetaToolChoiceTool: + title: ToolChoiceTool + required: + - type + - name + type: object + properties: + type: + title: Type + enum: + - tool + type: string + name: + title: Name + type: string + description: The name of the tool to use. + disable_parallel_tool_use: + title: Disable Parallel Tool Use + type: boolean + description: "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + additionalProperties: false + description: The model will use the specified tool with `tool_choice.name`. + BetaUsage: + title: Usage + required: + - input_tokens + - cache_creation_input_tokens + - cache_read_input_tokens + - output_tokens + type: object + properties: + input_tokens: + title: Input Tokens + type: integer + description: The number of input tokens which were used. + example: 2095 + cache_creation_input_tokens: + title: Cache Creation Input Tokens + type: integer + description: The number of input tokens used to create the cache entry. + default: + nullable: true + example: 2051 + cache_read_input_tokens: + title: Cache Read Input Tokens + type: integer + description: The number of input tokens read from the cache. + default: + nullable: true + example: 2051 + output_tokens: + title: Output Tokens + type: integer + description: The number of output tokens which were used. + example: 503 + CacheControlEphemeral: + title: CacheControlEphemeral + required: + - type + type: object + properties: + type: + title: Type + enum: + - ephemeral + type: string + additionalProperties: false + CompletionRequest: + title: CompletionRequest + required: + - prompt + - max_tokens_to_sample + - model + type: object + properties: + model: + $ref: '#/components/schemas/Model' + prompt: + title: Prompt + minLength: 1 + type: string + description: "The prompt that you want Claude to complete.\n\nFor proper response generation you will need to format your prompt using alternating `\\n\\nHuman:` and `\\n\\nAssistant:` conversational turns. For example:\n\n```\n\"\\n\\nHuman: {userQuestion}\\n\\nAssistant:\"\n```\n\nSee [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more details." + example: "\n\nHuman: Hello, world!\n\nAssistant:" + max_tokens_to_sample: + title: Max Tokens To Sample + minimum: 1 + type: integer + description: "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate." + example: 256 + stop_sequences: + title: Stop Sequences + type: array + items: + type: string + description: "Sequences that will cause the model to stop generating.\n\nOur models stop on `\"\\n\\nHuman:\"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating." + temperature: + title: Temperature + maximum: 1 + minimum: 0 + type: number + description: "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + example: 1 + top_p: + title: Top P + maximum: 1 + minimum: 0 + type: number + description: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 0.7 + top_k: + title: Top K + minimum: 0 + type: integer + description: "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 5 + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: An object describing metadata about the request. + stream: + title: Stream + type: boolean + description: "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/streaming) for details." + additionalProperties: false + example: + model: claude-2.1 + prompt: "\n\nHuman: Hello, world!\n\nAssistant:" + max_tokens_to_sample: 256 + CompletionResponse: + title: CompletionResponse + required: + - type + - id + - completion + - stop_reason + - model + type: object + properties: + type: + title: Type + enum: + - completion + type: string + description: "Object type.\n\nFor Text Completions, this is always `\"completion\"`." + default: completion + id: + title: Id + type: string + description: "Unique object identifier.\n\nThe format and length of IDs may change over time." + completion: + title: Completion + type: string + description: The resulting completion up to and excluding the stop sequences. + example: ' Hello! My name is Claude.' + stop_reason: + title: Stop Reason + type: string + description: "The reason that we stopped.\n\nThis may be one the following values:\n* `\"stop_sequence\"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model\n* `\"max_tokens\"`: we exceeded `max_tokens_to_sample` or the model's maximum" + nullable: true + example: stop_sequence + model: + $ref: '#/components/schemas/Model' + example: + completion: ' Hello! My name is Claude.' + id: compl_018CKm6gsux7P8yMcwZbeCPw + model: claude-2.1 + stop_reason: stop_sequence + type: completion + ContentBlockDeltaEvent: + title: ContentBlockDeltaEvent + required: + - type + - index + - delta + type: object + properties: + type: + title: Type + enum: + - content_block_delta + type: string + default: content_block_delta + index: + title: Index + type: integer + delta: + title: Delta + oneOf: + - $ref: '#/components/schemas/TextContentBlockDelta' + - $ref: '#/components/schemas/InputJsonContentBlockDelta' + discriminator: + propertyName: type + mapping: + input_json_delta: '#/components/schemas/InputJsonContentBlockDelta' + text_delta: '#/components/schemas/TextContentBlockDelta' + x-stainless-naming: + go: + model_name: ContentBlockDeltaEvent + ContentBlockStartEvent: + title: ContentBlockStartEvent + required: + - type + - index + - content_block + type: object + properties: + type: + title: Type + enum: + - content_block_start + type: string + default: content_block_start + index: + title: Index + type: integer + content_block: + title: Content Block + oneOf: + - $ref: '#/components/schemas/ResponseTextBlock' + - $ref: '#/components/schemas/ResponseToolUseBlock' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/ResponseTextBlock' + tool_use: '#/components/schemas/ResponseToolUseBlock' + x-stainless-naming: + go: + model_name: ContentBlockStartEvent + ContentBlockStopEvent: + title: ContentBlockStopEvent + required: + - type + - index + type: object + properties: + type: + title: Type + enum: + - content_block_stop + type: string + default: content_block_stop + index: + title: Index + type: integer + x-stainless-naming: + go: + model_name: ContentBlockStopEvent + CreateMessageParams: + title: CreateMessageParams required: - model - messages @@ -77,686 +2561,1465 @@ components: type: object properties: model: - title: Model - anyOf: - - type: string - description: The ID of the model to use for this request. - - title: Models - enum: - - claude-3-5-sonnet-latest - - claude-3-5-sonnet-20241022 - - claude-3-5-sonnet-20240620 - - claude-3-opus-latest - - claude-3-opus-20240229 - - claude-3-sonnet-20240229 - - claude-3-haiku-20240307 - - claude-2.1 - - claude-2.0 - type: string - description: "Available models. Mind that the list may not be exhaustive nor up-to-date.\n" - description: "The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional\ndetails and options.\n" - example: claude-3-5-sonnet-20241022 + $ref: '#/components/schemas/Model' messages: - minItems: 1 + title: Messages type: array items: - $ref: '#/components/schemas/Message' - description: "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant`\nconversational turns. When creating a new `Message`, you specify the prior\nconversational turns with the `messages` parameter, and the model then generates\nthe next `Message` in the conversation.\n\nEach input message must be an object with a `role` and `content`. You can\nspecify a single `user`-role message, or you can include multiple `user` and\n`assistant` messages. The first message must always use the `user` role.\n\nIf the final message uses the `assistant` role, the response content will\ncontinue immediately from the content in that message. This can be used to\nconstrain part of the model's response.\n\nSee [message content](https://docs.anthropic.com/en/api/messages-content) for\ndetails on how to construct valid message objects.\n\nExample with a single `user` message:\n\n```json\n[{ \"role\": \"user\", \"content\": \"Hello, Claude\" }]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n { \"role\": \"user\", \"content\": \"Hello there.\" },\n { \"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\" },\n { \"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\" }\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\n \"role\": \"user\",\n \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"\n },\n { \"role\": \"assistant\", \"content\": \"The best answer is (\" }\n]\n```\n\nEach input message `content` may be either a single `string` or an array of\ncontent blocks, where each block has a specific `type`. Using a `string` for\n`content` is shorthand for an array of one content block of type `\"text\"`. The\nfollowing input messages are equivalent:\n\n```json\n{ \"role\": \"user\", \"content\": \"Hello, Claude\" }\n```\n\n```json\n{ \"role\": \"user\", \"content\": [{ \"type\": \"text\", \"text\": \"Hello, Claude\" }] }\n```\n\nStarting with Claude 3 models, you can also send image content blocks:\n\n```json\n{\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"image\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"image/jpeg\",\n \"data\": \"/9j/4AAQSkZJRg...\"\n }\n },\n { \"type\": \"text\", \"text\": \"What is in this image?\" }\n ]\n}\n```\n\nWe currently support the `base64` source type for images, and the `image/jpeg`,\n`image/png`, `image/gif`, and `image/webp` media types.\n\nSee [examples](https://docs.anthropic.com/en/api/messages-examples) for more\ninput examples.\n\nNote that if you want to include a\n[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use\nthe top-level `system` parameter — there is no `\"system\"` role for input\nmessages in the Messages API.\n" + $ref: '#/components/schemas/InputMessage' + description: "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nStarting with Claude 3 models, you can also send image content blocks:\n\n```json\n{\"role\": \"user\", \"content\": [\n {\n \"type\": \"image\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"image/jpeg\",\n \"data\": \"/9j/4AAQSkZJRg...\",\n }\n },\n {\"type\": \"text\", \"text\": \"What is in this image?\"}\n]}\n```\n\nWe currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.\n\nSee [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.\n\nNote that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API." max_tokens: + title: Max Tokens + minimum: 1 type: integer - description: "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter\nonly specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See\n[models](https://docs.anthropic.com/en/docs/models-overview) for details.\n" + description: "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details." + example: 1024 metadata: - $ref: '#/components/schemas/CreateMessageRequestMetadata' + allOf: + - $ref: '#/components/schemas/Metadata' + description: An object describing metadata about the request. stop_sequences: + title: Stop Sequences type: array items: type: string - description: "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn,\nwhich will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of\ntext, you can use the `stop_sequences` parameter. If the model encounters one of\nthe custom sequences, the response `stop_reason` value will be `\"stop_sequence\"`\nand the response `stop_sequence` value will contain the matched stop sequence.\n" + description: "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + stream: + title: Stream + type: boolean + description: "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details." system: - type: string - oneOf: + title: System + anyOf: - type: string - description: A single text block. + x-stainless-skip: + - go - type: array items: - $ref: '#/components/schemas/Block' - description: An array of content blocks. - description: "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such\nas specifying a particular goal or role. See our\n[guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).\n" + $ref: '#/components/schemas/RequestTextBlock' + description: "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts)." + example: + - text: Today's date is 2024-06-01. + type: text temperature: + title: Temperature + maximum: 1 + minimum: 0 type: number - description: "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`\nfor analytical / multiple choice, and closer to `1.0` for creative and\ngenerative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully\ndeterministic.\n" + description: "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + example: 1 tool_choice: $ref: '#/components/schemas/ToolChoice' tools: + title: Tools type: array items: $ref: '#/components/schemas/Tool' - description: "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use`\ncontent blocks that represent the model's use of those tools. You can then run\nthose tools using the tool input generated by the model and then optionally\nreturn results back to the model using `tool_result` content blocks.\n\nEach tool definition includes:\n\n- `name`: Name of the tool.\n- `description`: Optional, but strongly-recommended description of the tool.\n- `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`\n shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce\n`tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an\ninput, and return the following back to the model in a subsequent `user`\nmessage:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and\nfunctions, or more generally whenever you want the model to produce a particular\nJSON structure of output.\n\nSee our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.\n" + description: "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details." + example: + description: Get the current weather in a given location + input_schema: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + name: get_weather top_k: + title: Top K + minimum: 0 type: integer - description: "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses.\n[Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use\n`temperature`.\n" + description: "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 5 top_p: + title: Top P + maximum: 1 + minimum: 0 type: number - description: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options\nfor each subsequent token in decreasing probability order and cut it off once it\nreaches a particular probability specified by `top_p`. You should either alter\n`temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use\n`temperature`.\n" - stream: - type: boolean - description: "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/messages-streaming) for\ndetails.\n" - default: false - description: The request parameters for creating a message. - CreateMessageRequestMetadata: + description: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 0.7 + additionalProperties: false + example: + max_tokens: 1024 + messages: + - content: 'Hello, world' + role: user + model: claude-3-5-sonnet-20241022 + ErrorResponse: + title: ErrorResponse + required: + - type + - error type: object properties: - user_id: + type: + title: Type + enum: + - error type: string - description: "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use\nthis id to help detect abuse. Do not include any identifying information such as\nname, email address, or phone number.\n" - description: An object describing metadata about the request. - ToolChoice: + default: error + error: + title: Error + oneOf: + - $ref: '#/components/schemas/InvalidRequestError' + - $ref: '#/components/schemas/AuthenticationError' + - $ref: '#/components/schemas/PermissionError' + - $ref: '#/components/schemas/NotFoundError' + - $ref: '#/components/schemas/RateLimitError' + - $ref: '#/components/schemas/APIError' + - $ref: '#/components/schemas/OverloadedError' + discriminator: + propertyName: type + mapping: + api_error: '#/components/schemas/APIError' + authentication_error: '#/components/schemas/AuthenticationError' + invalid_request_error: '#/components/schemas/InvalidRequestError' + not_found_error: '#/components/schemas/NotFoundError' + overloaded_error: '#/components/schemas/OverloadedError' + permission_error: '#/components/schemas/PermissionError' + rate_limit_error: '#/components/schemas/RateLimitError' + InputJsonContentBlockDelta: + title: InputJsonContentBlockDelta required: - type + - partial_json type: object properties: type: - $ref: '#/components/schemas/ToolChoiceType' - name: + title: Type + enum: + - input_json_delta type: string - description: The name of the tool to use. - disable_parallel_tool_use: - type: boolean - description: Whether to disable parallel tool use. - description: "How the model should use the provided tools. The model can use a specific tool, \nany available tool, or decide by itself.\n\n- `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.\n- `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.\n- `tool`: allows us to force Claude to always use a particular tool specified in the `name` field.\n" - ToolChoiceType: - enum: - - auto - - any - - tool - type: string - description: "How the model should use the provided tools. The model can use a specific tool, \nany available tool, or decide by itself.\n\n- `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.\n- `any`: tells Claude that it must use one of the provided tools, but doesn't force a particular tool.\n- `tool`: allows us to force Claude to always use a particular tool specified in the `name` field.\n" - Message: + default: input_json_delta + partial_json: + title: Partial Json + type: string + InputMessage: + title: InputMessage required: - - content - role + - content type: object properties: - id: + role: + title: Role + enum: + - user + - assistant type: string - description: "Unique object identifier.\n\nThe format and length of IDs may change over time.\n" content: - oneOf: + title: Content + anyOf: - type: string - description: A single text block. + x-stainless-skip: + - go - type: array items: - $ref: '#/components/schemas/Block' - description: An array of content blocks. - description: The content of the message. + title: Block + oneOf: + - $ref: '#/components/schemas/RequestTextBlock' + - $ref: '#/components/schemas/RequestImageBlock' + - $ref: '#/components/schemas/RequestToolUseBlock' + - $ref: '#/components/schemas/RequestToolResultBlock' + discriminator: + propertyName: type + mapping: + image: '#/components/schemas/RequestImageBlock' + text: '#/components/schemas/RequestTextBlock' + tool_result: '#/components/schemas/RequestToolResultBlock' + tool_use: '#/components/schemas/RequestToolUseBlock' + x-stainless-python-extend-union: + - ContentBlock + x-stainless-python-extend-union-imports: + - from .content_block import ContentBlock + example: + - type: text + text: What is a quaternion? + additionalProperties: false + InputSchema: + title: InputSchema + required: + - type + type: object + properties: + type: + title: Type + enum: + - object + type: string + properties: + title: Properties + type: object + nullable: true + InvalidRequestError: + title: InvalidRequestError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - invalid_request_error + type: string + default: invalid_request_error + message: + title: Message + type: string + default: Invalid request + Message: + title: Message + required: + - id + - type + - role + - content + - model + - stop_reason + - stop_sequence + - usage + type: object + properties: + id: + title: Id + type: string + description: "Unique object identifier.\n\nThe format and length of IDs may change over time." + example: msg_013Zva2CMHLNnXjNJJKqJ2EF + type: + title: Type + enum: + - message + type: string + description: "Object type.\n\nFor Messages, this is always `\"message\"`." + default: message role: - $ref: '#/components/schemas/MessageRole' + title: Role + enum: + - assistant + type: string + description: "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`." + default: assistant + content: + title: Content + type: array + items: + $ref: '#/components/schemas/ContentBlock' + description: "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```" + example: + - text: Hi! My name is Claude. + type: text model: + $ref: '#/components/schemas/Model' + stop_reason: + title: Stop Reason + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use + type: string + description: "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise." + nullable: true + stop_sequence: + title: Stop Sequence type: string - description: The model that handled the request. + description: "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated." + default: + nullable: true + usage: + allOf: + - $ref: '#/components/schemas/Usage' + description: "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude." + example: + input_tokens: 2095 + output_tokens: 503 + example: + content: + - text: Hi! My name is Claude. + type: text + id: msg_013Zva2CMHLNnXjNJJKqJ2EF + model: claude-3-5-sonnet-20241022 + role: assistant + stop_reason: end_turn + stop_sequence: + type: message + usage: + input_tokens: 2095 + output_tokens: 503 + x-stainless-python-custom-imports: + - from .content_block import ContentBlock as ContentBlock + MessageDelta: + title: MessageDelta + required: + - stop_reason + - stop_sequence + type: object + properties: stop_reason: - $ref: '#/components/schemas/StopReason' + title: Stop Reason + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use + type: string + default: + nullable: true stop_sequence: + title: Stop Sequence type: string - description: "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was\ngenerated.\n" + default: + nullable: true + MessageDeltaEvent: + title: MessageDeltaEvent + required: + - type + - delta + - usage + type: object + properties: type: + title: Type + enum: + - message_delta type: string - description: "Object type.\n\nFor Messages, this is always `\"message\"`.\n" + default: message_delta + delta: + $ref: '#/components/schemas/MessageDelta' usage: - $ref: '#/components/schemas/Usage' - description: A message in a chat conversation. - MessageRole: - enum: - - user - - assistant - type: string - description: The role of the messages author. - Tool: + allOf: + - $ref: '#/components/schemas/MessageDeltaUsage' + description: "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude." + example: + output_tokens: 503 + x-stainless-naming: + go: + model_name: MessageDeltaEvent + MessageDeltaUsage: + title: MessageDeltaUsage + required: + - output_tokens + type: object + properties: + output_tokens: + title: Output Tokens + type: integer + description: The cumulative number of output tokens which were used. + example: 503 + MessageStartEvent: + title: MessageStartEvent + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - message_start + type: string + default: message_start + message: + $ref: '#/components/schemas/Message' + x-stainless-naming: + go: + model_name: MessageStartEvent + MessageStopEvent: + title: MessageStopEvent + required: + - type + type: object + properties: + type: + title: Type + enum: + - message_stop + type: string + default: message_stop + x-stainless-naming: + go: + model_name: MessageStopEvent + MessageStreamEvent: + title: MessageStreamEvent oneOf: - - $ref: '#/components/schemas/ToolCustom' - - $ref: '#/components/schemas/ToolComputerUse' - - $ref: '#/components/schemas/ToolTextEditor' - - $ref: '#/components/schemas/ToolBash' - description: A tool the model may use. + - $ref: '#/components/schemas/MessageStartEvent' + - $ref: '#/components/schemas/MessageDeltaEvent' + - $ref: '#/components/schemas/MessageStopEvent' + - $ref: '#/components/schemas/ContentBlockStartEvent' + - $ref: '#/components/schemas/ContentBlockDeltaEvent' + - $ref: '#/components/schemas/ContentBlockStopEvent' + - $ref: '#/components/schemas/Ping' discriminator: propertyName: type - ToolCustom: + mapping: + content_block_delta: '#/components/schemas/ContentBlockDeltaEvent' + content_block_start: '#/components/schemas/ContentBlockStartEvent' + content_block_stop: '#/components/schemas/ContentBlockStopEvent' + message_delta: '#/components/schemas/MessageDeltaEvent' + message_start: '#/components/schemas/MessageStartEvent' + message_stop: '#/components/schemas/MessageStopEvent' + x-stainless-naming: + go: + model_name: MessageStreamEvent + Metadata: + title: Metadata + type: object + properties: + user_id: + title: User Id + maxLength: 256 + type: string + description: "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." + nullable: true + example: 13803d75-b4b5-4c3e-b2a2-6f21399b021b + additionalProperties: false + NotFoundError: + title: NotFoundError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - not_found_error + type: string + default: not_found_error + message: + title: Message + type: string + default: Not found + OverloadedError: + title: OverloadedError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - overloaded_error + type: string + default: overloaded_error + message: + title: Message + type: string + default: Overloaded + PermissionError: + title: PermissionError + required: + - type + - message + type: object + properties: + type: + title: Type + enum: + - permission_error + type: string + default: permission_error + message: + title: Message + type: string + default: Permission denied + PromptCachingBetaCreateMessageParams: + title: CreateMessageParams + required: + - model + - messages + - max_tokens + type: object + properties: + model: + $ref: '#/components/schemas/Model' + messages: + title: Messages + type: array + items: + $ref: '#/components/schemas/PromptCachingBetaInputMessage' + description: "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nStarting with Claude 3 models, you can also send image content blocks:\n\n```json\n{\"role\": \"user\", \"content\": [\n {\n \"type\": \"image\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"image/jpeg\",\n \"data\": \"/9j/4AAQSkZJRg...\",\n }\n },\n {\"type\": \"text\", \"text\": \"What is in this image?\"}\n]}\n```\n\nWe currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.\n\nSee [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.\n\nNote that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API." + max_tokens: + title: Max Tokens + minimum: 1 + type: integer + description: "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details." + example: 1024 + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: An object describing metadata about the request. + stop_sequences: + title: Stop Sequences + type: array + items: + type: string + description: "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + stream: + title: Stream + type: boolean + description: "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details." + system: + title: System + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/PromptCachingBetaRequestTextBlock' + description: "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts)." + example: + - text: Today's date is 2024-06-01. + type: text + temperature: + title: Temperature + maximum: 1 + minimum: 0 + type: number + description: "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + example: 1 + tool_choice: + $ref: '#/components/schemas/ToolChoice' + tools: + title: Tools + type: array + items: + $ref: '#/components/schemas/PromptCachingBetaTool' + description: "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details." + example: + description: Get the current weather in a given location + input_schema: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + name: get_weather + top_k: + title: Top K + minimum: 0 + type: integer + description: "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 5 + top_p: + title: Top P + maximum: 1 + minimum: 0 + type: number + description: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 0.7 + additionalProperties: false + example: + max_tokens: 1024 + messages: + - content: 'Hello, world' + role: user + model: claude-3-5-sonnet-20241022 + PromptCachingBetaInputMessage: + title: InputMessage required: - - name - - input_schema + - role + - content type: object properties: - type: - type: string - description: The type of tool. - default: - name: - type: string - description: 'The name of the tool. Must match the regex `^[a-zA-Z0-9_-]{1,64}$`.' - description: + role: + title: Role + enum: + - user + - assistant type: string - description: "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that\nthe model has about what the tool is and how to use it, the better it will\nperform. You can use natural language descriptions to reinforce important\naspects of the tool input JSON schema.\n" - input_schema: - type: object - description: "[JSON schema](https://json-schema.org/) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model\nwill produce.\n" - description: A custom tool the model may use. - ToolComputerUse: + content: + title: Content + anyOf: + - type: string + x-stainless-skip: + - go + - type: array + items: + title: Block + oneOf: + - $ref: '#/components/schemas/PromptCachingBetaRequestTextBlock' + - $ref: '#/components/schemas/PromptCachingBetaRequestImageBlock' + - $ref: '#/components/schemas/PromptCachingBetaRequestToolUseBlock' + - $ref: '#/components/schemas/PromptCachingBetaRequestToolResultBlock' + discriminator: + propertyName: type + mapping: + image: '#/components/schemas/PromptCachingBetaRequestImageBlock' + text: '#/components/schemas/PromptCachingBetaRequestTextBlock' + tool_result: '#/components/schemas/PromptCachingBetaRequestToolResultBlock' + tool_use: '#/components/schemas/PromptCachingBetaRequestToolUseBlock' + x-stainless-python-extend-union: + - ContentBlock + x-stainless-python-extend-union-imports: + - from ...content_block import ContentBlock + example: + - type: text + text: What is a quaternion? + additionalProperties: false + PromptCachingBetaMessage: + title: Message required: - - display_width_px - - display_height_px + - id + - type + - role + - content + - model + - stop_reason + - stop_sequence + - usage type: object properties: + id: + title: Id + type: string + description: "Unique object identifier.\n\nThe format and length of IDs may change over time." + example: msg_013Zva2CMHLNnXjNJJKqJ2EF type: + title: Type + enum: + - message type: string - description: The type of tool. - default: computer_20241022 - name: + description: "Object type.\n\nFor Messages, this is always `\"message\"`." + default: message + role: + title: Role + enum: + - assistant type: string - description: The name of the tool. - default: computer - cache_control: - $ref: '#/components/schemas/CacheControlEphemeral' - display_width_px: - type: integer - description: The width of the display in pixels. - display_height_px: - type: integer - description: The height of the display in pixels. - display_number: - type: integer - description: The number of the display to use. - nullable: true - description: 'A tool that uses a mouse and keyboard to interact with a computer, and take screenshots.' - ToolTextEditor: - type: object - properties: - type: + description: "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`." + default: assistant + content: + title: Content + type: array + items: + $ref: '#/components/schemas/ContentBlock' + description: "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```" + example: + - text: Hi! My name is Claude. + type: text + model: + $ref: '#/components/schemas/Model' + stop_reason: + title: Stop Reason + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use type: string - description: The type of tool. - default: text_editor_20241022 - name: + description: "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise." + nullable: true + stop_sequence: + title: Stop Sequence type: string - description: The name of the tool. - default: str_replace_editor - cache_control: - $ref: '#/components/schemas/CacheControlEphemeral' - description: 'A tool for viewing, creating and editing files.' - ToolBash: + description: "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated." + default: + nullable: true + usage: + allOf: + - $ref: '#/components/schemas/PromptCachingBetaUsage' + description: "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude." + example: + input_tokens: 2095 + output_tokens: 503 + example: + content: + - text: Hi! My name is Claude. + type: text + id: msg_013Zva2CMHLNnXjNJJKqJ2EF + model: claude-3-5-sonnet-20241022 + role: assistant + stop_reason: end_turn + stop_sequence: + type: message + usage: + input_tokens: 2095 + output_tokens: 503 + PromptCachingBetaMessageStartEvent: + title: MessageStartEvent + required: + - type + - message type: object properties: type: + title: Type + enum: + - message_start type: string - description: The type of tool. - default: bash_20241022 - name: - type: string - description: The name of the tool. - default: bash - cache_control: - $ref: '#/components/schemas/CacheControlEphemeral' - description: A tool for running commands in a bash shell. - Block: + default: message_start + message: + $ref: '#/components/schemas/PromptCachingBetaMessage' + PromptCachingBetaMessageStreamEvent: + title: MessageStreamEvent oneOf: - - $ref: '#/components/schemas/TextBlock' - - $ref: '#/components/schemas/ImageBlock' - - $ref: '#/components/schemas/ToolUseBlock' - - $ref: '#/components/schemas/ToolResultBlock' - description: A block of content in a message. + - $ref: '#/components/schemas/PromptCachingBetaMessageStartEvent' + - $ref: '#/components/schemas/MessageDeltaEvent' + - $ref: '#/components/schemas/MessageStopEvent' + - $ref: '#/components/schemas/ContentBlockStartEvent' + - $ref: '#/components/schemas/ContentBlockDeltaEvent' + - $ref: '#/components/schemas/ContentBlockStopEvent' discriminator: propertyName: type mapping: - text: '#/components/schemas/TextBlock' - image: '#/components/schemas/ImageBlock' - tool_use: '#/components/schemas/ToolUseBlock' - tool_result: '#/components/schemas/ToolResultBlock' - TextBlock: + content_block_delta: '#/components/schemas/ContentBlockDeltaEvent' + content_block_start: '#/components/schemas/ContentBlockStartEvent' + content_block_stop: '#/components/schemas/ContentBlockStopEvent' + message_delta: '#/components/schemas/MessageDeltaEvent' + message_start: '#/components/schemas/PromptCachingBetaMessageStartEvent' + message_stop: '#/components/schemas/MessageStopEvent' + PromptCachingBetaRequestImageBlock: + title: RequestImageBlock required: - - text - type - type: object - properties: - text: - type: string - description: The text content. - type: - enum: - - text - type: string - description: The type of content block. - default: text - cache_control: - $ref: '#/components/schemas/CacheControlEphemeral' - description: A block of text content. - ImageBlock: - required: - source - - type type: object properties: - source: - $ref: '#/components/schemas/ImageBlockSource' + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' type: + title: Type enum: - image type: string - description: The type of content block. - default: image - cache_control: - $ref: '#/components/schemas/CacheControlEphemeral' - description: A block of image content. - ImageBlockSource: + source: + title: Source + oneOf: + - $ref: '#/components/schemas/Base64ImageSource' + discriminator: + propertyName: type + mapping: + base64: '#/components/schemas/Base64ImageSource' + additionalProperties: false + PromptCachingBetaRequestTextBlock: + title: RequestTextBlock required: - - data - - media_type - type + - text type: object properties: - data: - type: string - description: The base64-encoded image data. - media_type: - enum: - - image/jpeg - - image/png - - image/gif - - image/webp - type: string - description: The media type of the image. + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' type: + title: Type enum: - - base64 + - text + type: string + text: + title: Text + minLength: 1 type: string - description: The type of image source. - description: The source of an image block. - ToolUseBlock: + additionalProperties: false + PromptCachingBetaRequestToolResultBlock: + title: RequestToolResultBlock required: - - id - - name - - input - type + - tool_use_id type: object properties: - id: - type: string - description: "A unique identifier for this particular tool use block. \nThis will be used to match up the tool results later.\n" - example: toolu_01A09q90qw90lq917835lq9 - name: - type: string - description: The name of the tool being used. - example: get_weather - input: - type: object - description: 'An object containing the input being passed to the tool, conforming to the tool''s `input_schema`.' + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' type: + title: Type enum: - - tool_use + - tool_result type: string - description: The type of content block. - default: tool_use - cache_control: - $ref: '#/components/schemas/CacheControlEphemeral' - description: The tool the model wants to use. - ToolResultBlock: - required: - - tool_use_id - - content - - type - type: object - properties: tool_use_id: + title: Tool Use Id + pattern: '^[a-zA-Z0-9_-]+$' type: string - description: The `id` of the tool use request this is a result for. + is_error: + title: Is Error + type: boolean content: - oneOf: + title: Content + anyOf: - type: string - description: A single text block. - type: array items: - $ref: '#/components/schemas/Block' - description: An array of content blocks. - description: "The result of the tool, as a string (e.g. `\"content\": \"15 degrees\"`) \nor list of nested content blocks (e.g. `\"content\": [{\"type\": \"text\", \"text\": \"15 degrees\"}]`). \nThese content blocks can use the text or image types.\n" - is_error: - type: boolean - description: Set to `true` if the tool execution resulted in an error. - type: - enum: - - tool_result - type: string - description: The type of content block. - default: tool_result - cache_control: - $ref: '#/components/schemas/CacheControlEphemeral' - description: The result of using a tool. - CacheControlEphemeral: + title: Block + oneOf: + - $ref: '#/components/schemas/PromptCachingBetaRequestTextBlock' + - $ref: '#/components/schemas/PromptCachingBetaRequestImageBlock' + discriminator: + propertyName: type + mapping: + image: '#/components/schemas/PromptCachingBetaRequestImageBlock' + text: '#/components/schemas/PromptCachingBetaRequestTextBlock' + x-stainless-naming: + python: + type_name: Content + additionalProperties: false + PromptCachingBetaRequestToolUseBlock: + title: RequestToolUseBlock + required: + - type + - id + - name + - input type: object properties: + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + nullable: true + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' type: + title: Type enum: - - ephemeral + - tool_use type: string - default: ephemeral - description: The cache control settings. - StopReason: - enum: - - end_turn - - max_tokens - - stop_sequence - - tool_use - type: string - description: "The reason that we stopped.\n\nThis may be one the following values:\n\n- `\"end_turn\"`: the model reached a natural stopping point\n- `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n- `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n- `\"tool_use\"`: the model invoked one or more tools\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is\nnull in the `message_start` event and non-null otherwise.\n" - nullable: true - Usage: - required: - - input_tokens - - output_tokens - type: object - properties: - input_tokens: - type: integer - description: The number of input tokens which were used. - output_tokens: - type: integer - description: The number of output tokens which were used. - cache_creation_input_tokens: - type: integer - description: The number of input tokens read from the cache. - cache_read_input_tokens: - type: integer - description: The number of input tokens used to create the cache entry. - description: "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the\nunderlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the\nmodel. The model's output then goes through a parsing stage before becoming an\nAPI response. As a result, the token counts in `usage` will not match one-to-one\nwith the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response\nfrom Claude.\n" - CreateMessageBatchRequest: - required: - - requests - type: object - properties: - requests: - type: array - items: - $ref: '#/components/schemas/BatchMessageRequest' - description: List of requests for prompt completion. Each is an individual request to create a Message. - description: The request parameters for creating a message batch. - BatchMessageRequest: - required: - - custom_id - - params - type: object - properties: - custom_id: + id: + title: Id + pattern: '^[a-zA-Z0-9_-]+$' type: string - description: "Developer-provided ID created for each request in a Message Batch. Useful for\nmatching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch.\n" - params: - $ref: '#/components/schemas/CreateMessageRequest' - description: An individual message request within a batch. - MessageBatch: + name: + title: Name + maxLength: 64 + minLength: 1 + pattern: '^[a-zA-Z0-9_-]{1,64}$' + type: string + input: + title: Input + type: object + additionalProperties: false + PromptCachingBetaTool: + title: Tool required: - - id - - created_at - - expires_at - - processing_status - - request_counts - - type + - name + - input_schema type: object properties: - id: - type: string - description: Unique object identifier for the message batch. - created_at: - type: string - description: RFC 3339 datetime string representing the time at which the Message Batch was created. - format: date-time - expires_at: - type: string - description: 'RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.' - format: date-time - processing_status: - enum: - - in_progress - - canceling - - ended + description: + title: Description type: string - description: Processing status of the Message Batch. - request_counts: - $ref: '#/components/schemas/MessageBatchRequestCounts' - results_url: + description: "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema." + example: Get the current weather in a given location + name: + title: Name + maxLength: 64 + minLength: 1 + pattern: '^[a-zA-Z0-9_-]{1,64}$' type: string - description: URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + description: "Name of the tool.\n\nThis is how the tool will be called by the model and in tool_use blocks." + input_schema: + allOf: + - $ref: '#/components/schemas/InputSchema' + description: "[JSON schema](https://json-schema.org/) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce." + example: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + cache_control: + title: Cache Control + type: 'null' + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' nullable: true - type: - enum: - - message_batch - type: string - description: 'Object type. For Message Batches, this is always `"message_batch"`.' - description: A batch of message requests. - MessageBatchRequestCounts: + discriminator: + propertyName: type + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + additionalProperties: false + PromptCachingBetaUsage: + title: Usage required: - - processing - - succeeded - - errored - - canceled - - expired + - input_tokens + - cache_creation_input_tokens + - cache_read_input_tokens + - output_tokens type: object - properties: - processing: - type: integer - description: Number of requests in the Message Batch that are processing. - succeeded: + properties: + input_tokens: + title: Input Tokens type: integer - description: Number of requests in the Message Batch that have completed successfully. - errored: + description: The number of input tokens which were used. + example: 2095 + cache_creation_input_tokens: + title: Cache Creation Input Tokens type: integer - description: Number of requests in the Message Batch that encountered an error. - canceled: + description: The number of input tokens used to create the cache entry. + default: + nullable: true + example: 2051 + cache_read_input_tokens: + title: Cache Read Input Tokens type: integer - description: Number of requests in the Message Batch that have been canceled. - expired: + description: The number of input tokens read from the cache. + default: + nullable: true + example: 2051 + output_tokens: + title: Output Tokens type: integer - description: Number of requests in the Message Batch that have expired. - description: 'Tallies requests within the Message Batch, categorized by their status.' - MessageStreamEvent: - type: object - oneOf: - - $ref: '#/components/schemas/MessageStartEvent' - - $ref: '#/components/schemas/MessageDeltaEvent' - - $ref: '#/components/schemas/MessageStopEvent' - - $ref: '#/components/schemas/ContentBlockStartEvent' - - $ref: '#/components/schemas/ContentBlockDeltaEvent' - - $ref: '#/components/schemas/ContentBlockStopEvent' - - $ref: '#/components/schemas/PingEvent' - - $ref: '#/components/schemas/ErrorEvent' - description: A event in a streaming conversation. - discriminator: - propertyName: type - mapping: - message_start: '#/components/schemas/MessageStartEvent' - message_delta: '#/components/schemas/MessageDeltaEvent' - message_stop: '#/components/schemas/MessageStopEvent' - content_block_start: '#/components/schemas/ContentBlockStartEvent' - content_block_delta: '#/components/schemas/ContentBlockDeltaEvent' - content_block_stop: '#/components/schemas/ContentBlockStopEvent' - ping: '#/components/schemas/PingEvent' - error: '#/components/schemas/ErrorEvent' - MessageStreamEventType: - enum: - - message_start - - message_delta - - message_stop - - content_block_start - - content_block_delta - - content_block_stop - - ping - - error - type: string - description: The type of a streaming event. - MessageStartEvent: + description: The number of output tokens which were used. + example: 503 + RateLimitError: + title: RateLimitError required: - - message - type + - message type: object properties: - message: - $ref: '#/components/schemas/Message' type: - $ref: '#/components/schemas/MessageStreamEventType' - description: A start event in a streaming conversation. - MessageDeltaEvent: + title: Type + enum: + - rate_limit_error + type: string + default: rate_limit_error + message: + title: Message + type: string + default: Rate limited + RequestImageBlock: + title: RequestImageBlock required: - - delta - type - - usage + - source type: object properties: - delta: - $ref: '#/components/schemas/MessageDelta' type: - $ref: '#/components/schemas/MessageStreamEventType' - usage: - $ref: '#/components/schemas/MessageDeltaUsage' - description: A delta event in a streaming conversation. - MessageDelta: + title: Type + enum: + - image + type: string + source: + title: Source + oneOf: + - $ref: '#/components/schemas/Base64ImageSource' + discriminator: + propertyName: type + mapping: + base64: '#/components/schemas/Base64ImageSource' + additionalProperties: false + RequestTextBlock: + title: RequestTextBlock + required: + - type + - text type: object properties: - stop_reason: - $ref: '#/components/schemas/StopReason' - stop_sequence: + type: + title: Type + enum: + - text type: string - description: "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was\ngenerated.\n" - description: A delta in a streaming message. - MessageDeltaUsage: + text: + title: Text + minLength: 1 + type: string + additionalProperties: false + RequestToolResultBlock: + title: RequestToolResultBlock required: - - output_tokens + - type + - tool_use_id type: object properties: - output_tokens: - type: integer - description: The cumulative number of output tokens which were used. - description: "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the\nunderlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the\nmodel. The model's output then goes through a parsing stage before becoming an\nAPI response. As a result, the token counts in `usage` will not match one-to-one\nwith the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response\nfrom Claude.\n" - MessageStopEvent: + type: + title: Type + enum: + - tool_result + type: string + tool_use_id: + title: Tool Use Id + pattern: '^[a-zA-Z0-9_-]+$' + type: string + is_error: + title: Is Error + type: boolean + content: + title: Content + anyOf: + - type: string + x-stainless-skip: + - go + - type: array + items: + title: Block + oneOf: + - $ref: '#/components/schemas/RequestTextBlock' + - $ref: '#/components/schemas/RequestImageBlock' + discriminator: + propertyName: type + mapping: + image: '#/components/schemas/RequestImageBlock' + text: '#/components/schemas/RequestTextBlock' + x-stainless-naming: + python: + type_name: Content + additionalProperties: false + RequestToolUseBlock: + title: RequestToolUseBlock required: - type + - id + - name + - input type: object properties: type: - $ref: '#/components/schemas/MessageStreamEventType' - description: A stop event in a streaming conversation. - ContentBlockStartEvent: + title: Type + enum: + - tool_use + type: string + id: + title: Id + pattern: '^[a-zA-Z0-9_-]+$' + type: string + name: + title: Name + maxLength: 64 + minLength: 1 + pattern: '^[a-zA-Z0-9_-]{1,64}$' + type: string + input: + title: Input + type: object + additionalProperties: false + ResponseTextBlock: + title: ResponseTextBlock required: - - content_block - - index - type + - text type: object properties: - content_block: - $ref: '#/components/schemas/Block' - index: - type: integer - description: The index of the content block. type: - $ref: '#/components/schemas/MessageStreamEventType' - description: A start event in a streaming content block. - ContentBlockDeltaEvent: + title: Type + enum: + - text + type: string + default: text + text: + title: Text + maxLength: 5000000 + minLength: 0 + type: string + ResponseToolUseBlock: + title: ResponseToolUseBlock required: - - delta - - index - type + - id + - name + - input type: object properties: - delta: - $ref: '#/components/schemas/BlockDelta' - index: - type: integer - description: The index of the content block. type: - $ref: '#/components/schemas/MessageStreamEventType' - description: A delta event in a streaming content block. - BlockDelta: - oneOf: - - $ref: '#/components/schemas/TextBlockDelta' - - $ref: '#/components/schemas/InputJsonBlockDelta' - description: A delta in a streaming message. - discriminator: - propertyName: type - mapping: - text_delta: '#/components/schemas/TextBlockDelta' - input_json_delta: '#/components/schemas/InputJsonBlockDelta' - TextBlockDelta: + title: Type + enum: + - tool_use + type: string + default: tool_use + id: + title: Id + pattern: '^[a-zA-Z0-9_-]+$' + type: string + name: + title: Name + minLength: 1 + type: string + input: + title: Input + type: object + TextContentBlockDelta: + title: TextContentBlockDelta required: - - text - type + - text type: object properties: - text: - type: string - description: The text delta. type: + title: Type + enum: + - text_delta type: string - description: The type of content block. default: text_delta - description: A delta in a streaming text block. - InputJsonBlockDelta: + text: + title: Text + type: string + Tool: + title: Tool required: - - text - - type + - name + - input_schema type: object properties: - partial_json: + description: + title: Description type: string - description: The partial JSON delta. - type: + description: "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema." + example: Get the current weather in a given location + name: + title: Name + maxLength: 64 + minLength: 1 + pattern: '^[a-zA-Z0-9_-]{1,64}$' type: string - description: The type of content block. - default: input_json_delta - description: A delta in a streaming input JSON. - ContentBlockStopEvent: + description: "Name of the tool.\n\nThis is how the tool will be called by the model and in tool_use blocks." + input_schema: + allOf: + - $ref: '#/components/schemas/InputSchema' + description: "[JSON schema](https://json-schema.org/) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce." + example: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + additionalProperties: false + ToolChoiceAny: + title: ToolChoiceAny required: - - index - type type: object properties: - index: - type: integer - description: The index of the content block. type: - $ref: '#/components/schemas/MessageStreamEventType' - description: A stop event in a streaming content block. - PingEvent: + title: Type + enum: + - any + type: string + disable_parallel_tool_use: + title: Disable Parallel Tool Use + type: boolean + description: "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + additionalProperties: false + description: The model will use any available tools. + ToolChoiceAuto: + title: ToolChoiceAuto required: - type type: object properties: type: - $ref: '#/components/schemas/MessageStreamEventType' - description: A ping event in a streaming conversation. - ErrorEvent: + title: Type + enum: + - auto + type: string + disable_parallel_tool_use: + title: Disable Parallel Tool Use + type: boolean + description: "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use." + additionalProperties: false + description: The model will automatically decide whether to use tools. + ToolChoiceTool: + title: ToolChoiceTool required: - type - - error + - name type: object properties: type: - $ref: '#/components/schemas/MessageStreamEventType' - error: - $ref: '#/components/schemas/Error' - description: An error event in a streaming conversation. - Error: + title: Type + enum: + - tool + type: string + name: + title: Name + type: string + description: The name of the tool to use. + disable_parallel_tool_use: + title: Disable Parallel Tool Use + type: boolean + description: "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + additionalProperties: false + description: The model will use the specified tool with `tool_choice.name`. + Usage: + title: Usage + required: + - input_tokens + - output_tokens + type: object + properties: + input_tokens: + title: Input Tokens + type: integer + description: The number of input tokens which were used. + example: 2095 + output_tokens: + title: Output Tokens + type: integer + description: The number of output tokens which were used. + example: 503 + BetaMessageBatchResult: + title: Result + oneOf: + - $ref: '#/components/schemas/BetaSucceededResult' + - $ref: '#/components/schemas/BetaErroredResult' + - $ref: '#/components/schemas/BetaCanceledResult' + - $ref: '#/components/schemas/BetaExpiredResult' + description: "Processing result for this request.\n\nContains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration." + discriminator: + propertyName: type + mapping: + canceled: '#/components/schemas/BetaCanceledResult' + errored: '#/components/schemas/BetaErroredResult' + expired: '#/components/schemas/BetaExpiredResult' + succeeded: '#/components/schemas/BetaSucceededResult' + CreateMessageParamsWithoutStream: + title: CreateMessageParams + required: + - model + - messages + - max_tokens + type: object + properties: + model: + $ref: '#/components/schemas/Model' + messages: + title: Messages + type: array + items: + $ref: '#/components/schemas/InputMessage' + description: "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nStarting with Claude 3 models, you can also send image content blocks:\n\n```json\n{\"role\": \"user\", \"content\": [\n {\n \"type\": \"image\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"image/jpeg\",\n \"data\": \"/9j/4AAQSkZJRg...\",\n }\n },\n {\"type\": \"text\", \"text\": \"What is in this image?\"}\n]}\n```\n\nWe currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.\n\nSee [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.\n\nNote that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API." + max_tokens: + title: Max Tokens + minimum: 1 + type: integer + description: "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.anthropic.com/en/docs/models-overview) for details." + example: 1024 + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: An object describing metadata about the request. + stop_sequences: + title: Stop Sequences + type: array + items: + type: string + description: "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + system: + title: System + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/RequestTextBlock' + description: "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts)." + example: + - text: Today's date is 2024-06-01. + type: text + temperature: + title: Temperature + maximum: 1 + minimum: 0 + type: number + description: "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + example: 1 + tool_choice: + $ref: '#/components/schemas/ToolChoice' + tools: + title: Tools + type: array + items: + $ref: '#/components/schemas/Tool' + description: "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details." + example: + description: Get the current weather in a given location + input_schema: + properties: + location: + description: 'The city and state, e.g. San Francisco, CA' + type: string + unit: + description: 'Unit for the output - one of (celsius, fahrenheit)' + type: string + required: + - location + type: object + name: get_weather + top_k: + title: Top K + minimum: 0 + type: integer + description: "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 5 + top_p: + title: Top P + maximum: 1 + minimum: 0 + type: number + description: "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." + example: 0.7 + additionalProperties: false + example: + max_tokens: 1024 + messages: + - content: 'Hello, world' + role: user + model: claude-3-5-sonnet-20241022 + AnthropicBeta: + anyOf: + - type: string + - title: Preset + enum: + - message-batches-2024-09-24 + - prompt-caching-2024-07-31 + - computer-use-2024-10-22 + - pdfs-2024-09-25 + - token-counting-2024-11-01 + type: string + x-stainless-nominal: false + ToolChoice: + title: Tool Choice + oneOf: + - $ref: '#/components/schemas/ToolChoiceAuto' + - $ref: '#/components/schemas/ToolChoiceAny' + - $ref: '#/components/schemas/ToolChoiceTool' + description: 'How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself.' + discriminator: + propertyName: type + mapping: + any: '#/components/schemas/ToolChoiceAny' + auto: '#/components/schemas/ToolChoiceAuto' + tool: '#/components/schemas/ToolChoiceTool' + BetaToolChoice: + title: Tool Choice + oneOf: + - $ref: '#/components/schemas/BetaToolChoiceAuto' + - $ref: '#/components/schemas/BetaToolChoiceAny' + - $ref: '#/components/schemas/BetaToolChoiceTool' + description: 'How the model should use the provided tools. The model can use a specific tool, any available tool, or decide by itself.' + discriminator: + propertyName: type + mapping: + any: '#/components/schemas/BetaToolChoiceAny' + auto: '#/components/schemas/BetaToolChoiceAuto' + tool: '#/components/schemas/BetaToolChoiceTool' + ContentBlock: + oneOf: + - $ref: '#/components/schemas/ResponseTextBlock' + - $ref: '#/components/schemas/ResponseToolUseBlock' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/ResponseTextBlock' + tool_use: '#/components/schemas/ResponseToolUseBlock' + BetaContentBlock: + oneOf: + - $ref: '#/components/schemas/BetaResponseTextBlock' + - $ref: '#/components/schemas/BetaResponseToolUseBlock' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/BetaResponseTextBlock' + tool_use: '#/components/schemas/BetaResponseToolUseBlock' + BetaInputContentBlock: + oneOf: + - $ref: '#/components/schemas/BetaRequestTextBlock' + - $ref: '#/components/schemas/BetaRequestImageBlock' + - $ref: '#/components/schemas/BetaRequestToolUseBlock' + - $ref: '#/components/schemas/BetaRequestToolResultBlock' + - $ref: '#/components/schemas/BetaRequestPDFBlock' + discriminator: + propertyName: type + mapping: + document: '#/components/schemas/BetaRequestPDFBlock' + image: '#/components/schemas/BetaRequestImageBlock' + text: '#/components/schemas/BetaRequestTextBlock' + tool_result: '#/components/schemas/BetaRequestToolResultBlock' + tool_use: '#/components/schemas/BetaRequestToolUseBlock' + Model: + title: Model + type: 'null' + anyOf: + - type: string + - title: Preset + enum: + - claude-3-5-haiku-latest + - claude-3-haiku-20241022 + - claude-3-5-sonnet-latest + - claude-3-5-sonnet-20241022 + - claude-3-5-sonnet-20240620 + - claude-3-opus-latest + - claude-3-opus-20240229 + - claude-3-sonnet-20240229 + - claude-3-haiku-20240307 + - claude-2.1 + - claude-2.0 + - claude-instant-1.2 + type: string + x-enum-descriptions: + - Fast and cost-effective model + - Fast and cost-effective model + - Our most intelligent model + - Our most intelligent model + - Our previous most intelligent model + - Excels at writing and complex tasks + - Excels at writing and complex tasks + - Balance of speed and intelligence + - Our previous fast and cost-effective + - + - + - + x-stainless-nominal: false + description: 'The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.' + Ping: required: - type - - message type: object properties: type: + enum: + - ping type: string - description: The type of error. - message: - type: string - description: A human-readable error message. - description: An error object. + default: ping securitySchemes: ApiKeyAuth: type: apiKey name: x-api-key in: header security: - - ApiKeyAuth: [ ] -tags: - - name: Messages - description: 'Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.' \ No newline at end of file + - ApiKeyAuth: [ ] \ No newline at end of file diff --git a/src/tests/Anthropic.IntegrationTests/Tests.CompleteHistory.cs b/src/tests/Anthropic.IntegrationTests/Tests.CompleteHistory.cs index 213cd34..de59fc4 100755 --- a/src/tests/Anthropic.IntegrationTests/Tests.CompleteHistory.cs +++ b/src/tests/Anthropic.IntegrationTests/Tests.CompleteHistory.cs @@ -7,8 +7,8 @@ public async Task CompleteHistory() { using var client = GetAuthenticatedClient(); - var response = await client.CreateMessageAsync( - model: CreateMessageRequestModel.Claude35Sonnet20240620, + var response = await client.Messages.MessagesPostAsync( + model: ModelEnum.Claude35Sonnet20240620, messages: [ "What's the weather like today?", "Sure! Could you please provide me with your location?".AsAssistantMessage(), @@ -24,10 +24,10 @@ public async Task CompleteHistory() topK: 0, topP: 0, stream: false); - response.Model.Should().Be(CreateMessageRequestModel.Claude35Sonnet20240620.ToValueString()); - response.Content.Value2.Should().NotBeNullOrEmpty(); - response.Content.Value2!.First().Text?.Text.Should().NotBeNullOrEmpty(); - response.StopReason.Should().Be(StopReason.EndTurn); + response.Model.Value2.Should().Be(ModelEnum.Claude35Sonnet20240620); + response.Content.Should().NotBeNullOrEmpty(); + response.Content.First().Text?.Text.Should().NotBeNullOrEmpty(); + response.StopReason.Should().Be(MessageStopReason.EndTurn); response.AsSimpleText().Should().NotBeNullOrEmpty(); Console.WriteLine(response.AsSimpleText()); diff --git a/src/tests/Anthropic.IntegrationTests/Tests.FiveRandomWords.cs b/src/tests/Anthropic.IntegrationTests/Tests.FiveRandomWords.cs index fb36a6d..f71038d 100755 --- a/src/tests/Anthropic.IntegrationTests/Tests.FiveRandomWords.cs +++ b/src/tests/Anthropic.IntegrationTests/Tests.FiveRandomWords.cs @@ -7,8 +7,8 @@ public async Task FiveRandomWords() { using var client = GetAuthenticatedClient(); - var response = await client.CreateMessageAsync( - model: CreateMessageRequestModel.Claude35Sonnet20240620, + var response = await client.Messages.MessagesPostAsync( + model: ModelEnum.Claude35Sonnet20240620, messages: ["Generate 5 random words."], maxTokens: 250, metadata: null, @@ -20,10 +20,10 @@ public async Task FiveRandomWords() topK: 0, topP: 0, stream: false); - response.Model.Should().Be(CreateMessageRequestModel.Claude35Sonnet20240620.ToValueString()); - response.Content.Value2.Should().NotBeNullOrEmpty(); - response.Content.Value2!.First().Text?.Text.Should().NotBeNullOrEmpty(); - response.StopReason.Should().Be(StopReason.EndTurn); + response.Model.Object.Should().Be(ModelEnum.Claude35Sonnet20240620); + response.Content.Should().NotBeNullOrEmpty(); + response.Content!.First().Text?.Text.Should().NotBeNullOrEmpty(); + response.StopReason.Should().Be(MessageStopReason.EndTurn); response.AsSimpleText().Should().NotBeNullOrEmpty(); Console.WriteLine(response.AsSimpleText()); diff --git a/src/tests/Anthropic.IntegrationTests/Tests.Streaming.cs b/src/tests/Anthropic.IntegrationTests/Tests.Streaming.cs index fed8ef2..5dcf51f 100755 --- a/src/tests/Anthropic.IntegrationTests/Tests.Streaming.cs +++ b/src/tests/Anthropic.IntegrationTests/Tests.Streaming.cs @@ -7,12 +7,12 @@ public async Task Streaming() { using var client = GetAuthenticatedClient(); - var enumerable = client.CreateMessageAsStreamAsync(new CreateMessageRequest + var enumerable = client.CreateMessageAsStreamAsync(new CreateMessageParams { - Model = CreateMessageRequestModel.Claude35Sonnet20240620, + Model = ModelEnum.Claude35Sonnet20240620, Messages = ["Once upon a time"], MaxTokens = 250, - }); + }, anthropicVersion: "2023-06-01"); var deltas = new List(); await foreach (var response in enumerable) diff --git a/src/tests/Anthropic.IntegrationTests/Tests.Tools.cs b/src/tests/Anthropic.IntegrationTests/Tests.Tools.cs index 736eba3..1eb13cd 100755 --- a/src/tests/Anthropic.IntegrationTests/Tests.Tools.cs +++ b/src/tests/Anthropic.IntegrationTests/Tests.Tools.cs @@ -9,33 +9,29 @@ public async Task Tools() var service = new WeatherService(); var tools = service.AsTools().AsAnthropicTools(); - List messages = ["What is the current temperature in Dubai, UAE in Celsius?"]; + List messages = ["What is the current temperature in Dubai, UAE in Celsius?"]; - var response = await client.CreateMessageAsync( - model: CreateMessageRequestModel.Claude35Sonnet20240620, + var response = await client.Messages.MessagesPostAsync( + model: ModelEnum.Claude35Sonnet20240620, messages: messages, maxTokens: 300, metadata: null, stopSequences: null, system: "You are a helpful weather assistant.", temperature: 0, - toolChoice: new ToolChoice - { - Type = ToolChoiceType.Auto, - Name = null, - }, + toolChoice: new ToolChoiceAuto(), tools: tools, topK: 0, topP: 0, stream: false); - response.Model.Should().Be(CreateMessageRequestModel.Claude35Sonnet20240620.ToValueString()); - response.Content.Value2.Should().NotBeNullOrEmpty(); - response.Content.Value2!.First().Text?.Text.Should().NotBeNullOrEmpty(); - response.StopReason.Should().Be(StopReason.ToolUse); + response.Model.Object.Should().Be(ModelEnum.Claude35Sonnet20240620); + response.Content.Should().NotBeNullOrEmpty(); + response.Content.First().Text?.Text.Should().NotBeNullOrEmpty(); + response.StopReason.Should().Be(MessageStopReason.ToolUse); - messages.Add(response.AsRequestMessage()); + messages.Add(response.AsInputMessage()); - foreach (var toolUse in response.Content.Value2! + foreach (var toolUse in response.Content .Where(x => x.IsToolUse) .Select(x => x.ToolUse)) { @@ -45,27 +41,23 @@ public async Task Tools() messages.Add(json.AsToolCall(toolUse)); } - response = await client.CreateMessageAsync( - model: CreateMessageRequestModel.Claude35Sonnet20240620, + response = await client.Messages.MessagesPostAsync( + model: ModelEnum.Claude35Sonnet20240620, messages: messages, maxTokens: 300, metadata: null, stopSequences: null, system: "You are a helpful weather assistant.", temperature: 0, - toolChoice: new ToolChoice - { - Type = ToolChoiceType.Auto, - Name = null, - }, + toolChoice: new ToolChoiceAuto(), tools: tools, topK: 0, topP: 0, stream: false); - response.Model.Should().Be(CreateMessageRequestModel.Claude35Sonnet20240620.ToValueString()); - response.Content.Value2.Should().NotBeNullOrEmpty(); - response.Content.Value2!.First().Text?.Text.Should().NotBeNullOrEmpty(); - response.StopReason.Should().Be(StopReason.EndTurn); + response.Model.Object.Should().Be(ModelEnum.Claude35Sonnet20240620); + response.Content.Should().NotBeNullOrEmpty(); + response.Content!.First().Text?.Text.Should().NotBeNullOrEmpty(); + response.StopReason.Should().Be(MessageStopReason.EndTurn); response.AsSimpleText().Should().NotBeNullOrEmpty(); Console.WriteLine(response.AsSimpleText());