diff --git a/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs b/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs index c2bce9a..eeb9580 100644 --- a/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs +++ b/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs @@ -25,6 +25,19 @@ namespace Groq #endif public bool IsValue1 => Value1 != null; + /// + /// + /// + public bool TryPickValue1( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T1? value) + { + value = Value1; + return IsValue1; + } + /// /// /// @@ -41,6 +54,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))] #endif public bool IsValue2 => Value2 != null; + + /// + /// + /// + public bool TryPickValue2( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T2? value) + { + value = Value2; + return IsValue2; + } /// /// /// @@ -143,6 +169,30 @@ public bool Validate() /// 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 void Switch( + global::System.Action? value1 = null, global::System.Action? value2 = null, bool validate = true) { diff --git a/src/libs/Groq/Generated/Groq.GroqClient.Constructors.Bearer.g.cs b/src/libs/Groq/Generated/Groq.GroqClient.Constructors.Bearer.g.cs index 2df2f8d..4a99fc3 100644 --- a/src/libs/Groq/Generated/Groq.GroqClient.Constructors.Bearer.g.cs +++ b/src/libs/Groq/Generated/Groq.GroqClient.Constructors.Bearer.g.cs @@ -26,5 +26,6 @@ partial void Authorizing( ref string apiKey); partial void Authorized( global::System.Net.Http.HttpClient client); + } } \ No newline at end of file diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs index 0a01b95..8c71730 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs @@ -31,6 +31,19 @@ namespace Groq #endif public bool IsText => Text != null; + /// + /// + /// + public bool TryPickText( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionDocumentSourceText? value) + { + value = Text; + return IsText; + } + /// /// A document whose contents are provided inline as JSON data. /// @@ -47,6 +60,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Json))] #endif public bool IsJson => Json != null; + + /// + /// + /// + public bool TryPickJson( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionDocumentSourceJSON? value) + { + value = Json; + return IsJson; + } /// /// /// @@ -126,8 +152,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? text = null, - global::System.Func? json = null, + global::System.Func? text = null, + global::System.Func? json = null, bool validate = true) { if (validate) @@ -151,8 +177,32 @@ public bool Validate() /// /// public void Match( - global::System.Action? text = null, - global::System.Action? json = null, + global::System.Action? text = null, + + global::System.Action? json = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsJson) + { + json?.Invoke(Json!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? text = null, + global::System.Action? json = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs index f4e837b..52b96b2 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs @@ -31,6 +31,19 @@ namespace Groq #endif public bool IsSystem => System != null; + /// + /// + /// + public bool TryPickSystem( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestSystemMessage? value) + { + value = System; + return IsSystem; + } + /// /// /// @@ -48,6 +61,19 @@ namespace Groq #endif public bool IsUser => User != null; + /// + /// + /// + public bool TryPickUser( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestUserMessage? value) + { + value = User; + return IsUser; + } + /// /// /// @@ -65,6 +91,19 @@ namespace Groq #endif public bool IsAssistant => Assistant != null; + /// + /// + /// + public bool TryPickAssistant( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestAssistantMessage? value) + { + value = Assistant; + return IsAssistant; + } + /// /// /// @@ -82,6 +121,19 @@ namespace Groq #endif public bool IsTool => Tool != null; + /// + /// + /// + public bool TryPickTool( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestToolMessage? value) + { + value = Tool; + return IsTool; + } + /// /// /// @@ -98,6 +150,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Function))] #endif public bool IsFunction => Function != null; + + /// + /// + /// + public bool TryPickFunction( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestFunctionMessage? value) + { + value = Function; + return IsFunction; + } /// /// /// @@ -243,11 +308,11 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? system = null, - global::System.Func? user = null, - global::System.Func? assistant = null, - global::System.Func? tool = null, - global::System.Func? function = null, + global::System.Func? system = null, + global::System.Func? user = null, + global::System.Func? assistant = null, + global::System.Func? tool = null, + global::System.Func? function = null, bool validate = true) { if (validate) @@ -283,11 +348,53 @@ public bool Validate() /// /// public void Match( - global::System.Action? system = null, - global::System.Action? user = null, - global::System.Action? assistant = null, - global::System.Action? tool = null, - global::System.Action? function = null, + global::System.Action? system = null, + + global::System.Action? user = null, + + global::System.Action? assistant = null, + + global::System.Action? tool = null, + + global::System.Action? function = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsSystem) + { + system?.Invoke(System!); + } + else if (IsUser) + { + user?.Invoke(User!); + } + else if (IsAssistant) + { + assistant?.Invoke(Assistant!); + } + else if (IsTool) + { + tool?.Invoke(Tool!); + } + else if (IsFunction) + { + function?.Invoke(Function!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? system = null, + global::System.Action? user = null, + global::System.Action? assistant = null, + global::System.Action? tool = null, + global::System.Action? function = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs index deed1aa..e03abca 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs @@ -26,6 +26,19 @@ namespace Groq #endif public bool IsTextContentPart => TextContentPart != null; + /// + /// + /// + public bool TryPickTextContentPart( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestMessageContentPartText? value) + { + value = TextContentPart; + return IsTextContentPart; + } + /// /// /// @@ -43,6 +56,19 @@ namespace Groq #endif public bool IsImageContentPart => ImageContentPart != null; + /// + /// + /// + public bool TryPickImageContentPart( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestMessageContentPartImage? value) + { + value = ImageContentPart; + return IsImageContentPart; + } + /// /// /// @@ -59,6 +85,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(DocumentContentPart))] #endif public bool IsDocumentContentPart => DocumentContentPart != null; + + /// + /// + /// + public bool TryPickDocumentContentPart( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionRequestMessageContentPartDocument? value) + { + value = DocumentContentPart; + return IsDocumentContentPart; + } /// /// /// @@ -157,9 +196,9 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? textContentPart = null, - global::System.Func? imageContentPart = null, - global::System.Func? documentContentPart = null, + global::System.Func? textContentPart = null, + global::System.Func? imageContentPart = null, + global::System.Func? documentContentPart = null, bool validate = true) { if (validate) @@ -187,9 +226,39 @@ public bool Validate() /// /// public void Match( - global::System.Action? textContentPart = null, - global::System.Action? imageContentPart = null, - global::System.Action? documentContentPart = null, + global::System.Action? textContentPart = null, + + global::System.Action? imageContentPart = null, + + global::System.Action? documentContentPart = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsTextContentPart) + { + textContentPart?.Invoke(TextContentPart!); + } + else if (IsImageContentPart) + { + imageContentPart?.Invoke(ImageContentPart!); + } + else if (IsDocumentContentPart) + { + documentContentPart?.Invoke(DocumentContentPart!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? textContentPart = null, + global::System.Action? imageContentPart = null, + global::System.Action? documentContentPart = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs index ba72ac4..f99d45c 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs @@ -31,6 +31,19 @@ namespace Groq #endif public bool IsEnum => Enum != null; + /// + /// + /// + public bool TryPickEnum( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionToolChoiceOptionEnum? value) + { + value = Enum; + return IsEnum; + } + /// /// Specifies a tool the model should use. Use to force the model to call a specific function. /// @@ -47,6 +60,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Named))] #endif public bool IsNamed => Named != null; + + /// + /// + /// + public bool TryPickNamed( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ChatCompletionNamedToolChoice? value) + { + value = Named; + return IsNamed; + } /// /// /// @@ -124,7 +150,7 @@ public bool Validate() /// public TResult? Match( global::System.Func? @enum = null, - global::System.Func? named = null, + global::System.Func? named = null, bool validate = true) { if (validate) @@ -149,7 +175,31 @@ public bool Validate() /// public void Match( global::System.Action? @enum = null, - global::System.Action? named = null, + + global::System.Action? named = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsEnum) + { + @enum?.Invoke(Enum!); + } + else if (IsNamed) + { + named?.Invoke(Named!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? @enum = null, + global::System.Action? named = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs index f95f64b..39f314c 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs @@ -31,6 +31,19 @@ namespace Groq #endif public bool IsFileCitation => FileCitation != null; + /// + /// + /// + public bool TryPickFileCitation( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseFileCitation? value) + { + value = FileCitation; + return IsFileCitation; + } + /// /// A citation for a web resource. /// @@ -47,6 +60,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(UrlCitation))] #endif public bool IsUrlCitation => UrlCitation != null; + + /// + /// + /// + public bool TryPickUrlCitation( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseUrlCitation? value) + { + value = UrlCitation; + return IsUrlCitation; + } /// /// /// @@ -126,8 +152,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? fileCitation = null, - global::System.Func? urlCitation = null, + global::System.Func? fileCitation = null, + global::System.Func? urlCitation = null, bool validate = true) { if (validate) @@ -151,8 +177,32 @@ public bool Validate() /// /// public void Match( - global::System.Action? fileCitation = null, - global::System.Action? urlCitation = null, + global::System.Action? fileCitation = null, + + global::System.Action? urlCitation = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsFileCitation) + { + fileCitation?.Invoke(FileCitation!); + } + else if (IsUrlCitation) + { + urlCitation?.Invoke(UrlCitation!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? fileCitation = null, + global::System.Action? urlCitation = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs index e77a6dc..9a87687 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs @@ -26,6 +26,19 @@ namespace Groq #endif public bool IsText => Text != null; + /// + /// + /// + public bool TryPickText( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseFormatText? value) + { + value = Text; + return IsText; + } + /// /// JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so. /// @@ -43,6 +56,19 @@ namespace Groq #endif public bool IsJsonObject => JsonObject != null; + /// + /// + /// + public bool TryPickJsonObject( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseFormatJsonObject? value) + { + value = JsonObject; + return IsJsonObject; + } + /// /// JSON Schema response format. Used to generate structured JSON responses. /// @@ -59,6 +85,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(JsonSchema))] #endif public bool IsJsonSchema => JsonSchema != null; + + /// + /// + /// + public bool TryPickJsonSchema( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.TextResponseFormatJsonSchema? value) + { + value = JsonSchema; + return IsJsonSchema; + } /// /// /// @@ -157,9 +196,9 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? text = null, - global::System.Func? jsonObject = null, - global::System.Func? jsonSchema = null, + global::System.Func? text = null, + global::System.Func? jsonObject = null, + global::System.Func? jsonSchema = null, bool validate = true) { if (validate) @@ -187,9 +226,39 @@ public bool Validate() /// /// public void Match( - global::System.Action? text = null, - global::System.Action? jsonObject = null, - global::System.Action? jsonSchema = null, + global::System.Action? text = null, + + global::System.Action? jsonObject = null, + + global::System.Action? jsonSchema = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsJsonObject) + { + jsonObject?.Invoke(JsonObject!); + } + else if (IsJsonSchema) + { + jsonSchema?.Invoke(JsonSchema!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? text = null, + global::System.Action? jsonObject = null, + global::System.Action? jsonSchema = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs index b868282..7add0e3 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs @@ -30,6 +30,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(InputText))] #endif public bool IsInputText => InputText != null; + + /// + /// + /// + public bool TryPickInputText( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseInputTextContent? value) + { + value = InputText; + return IsInputText; + } /// /// /// @@ -87,7 +100,7 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? inputText = null, + global::System.Func? inputText = null, bool validate = true) { if (validate) @@ -107,7 +120,25 @@ public bool Validate() /// /// public void Match( - global::System.Action? inputText = null, + global::System.Action? inputText = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsInputText) + { + inputText?.Invoke(InputText!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? inputText = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs index e8f4982..a45c7de 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs @@ -26,6 +26,19 @@ namespace Groq #endif public bool IsEasyInputMessage => EasyInputMessage != null; + /// + /// + /// + public bool TryPickEasyInputMessage( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseEasyInputMessage? value) + { + value = EasyInputMessage; + return IsEasyInputMessage; + } + /// /// A message input to the model with explicit type field. /// @@ -43,6 +56,19 @@ namespace Groq #endif public bool IsMessage => Message != null; + /// + /// + /// + public bool TryPickMessage( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseInputMessage? value) + { + value = Message; + return IsMessage; + } + /// /// An internal identifier for an item to reference. /// @@ -60,6 +86,19 @@ namespace Groq #endif public bool IsItemReference => ItemReference != null; + /// + /// + /// + public bool TryPickItemReference( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseItemReference? value) + { + value = ItemReference; + return IsItemReference; + } + /// /// A function call generated by the model. /// @@ -77,6 +116,19 @@ namespace Groq #endif public bool IsFunctionCall => FunctionCall != null; + /// + /// + /// + public bool TryPickFunctionCall( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseFunctionCall? value) + { + value = FunctionCall; + return IsFunctionCall; + } + /// /// The output of a function tool call. /// @@ -93,6 +145,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(FunctionCallOutput))] #endif public bool IsFunctionCallOutput => FunctionCallOutput != null; + + /// + /// + /// + public bool TryPickFunctionCallOutput( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseFunctionCallOutput? value) + { + value = FunctionCallOutput; + return IsFunctionCallOutput; + } /// /// /// @@ -235,11 +300,11 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? easyInputMessage = null, - global::System.Func? message = null, - global::System.Func? itemReference = null, - global::System.Func? functionCall = null, - global::System.Func? functionCallOutput = null, + global::System.Func? easyInputMessage = null, + global::System.Func? message = null, + global::System.Func? itemReference = null, + global::System.Func? functionCall = null, + global::System.Func? functionCallOutput = null, bool validate = true) { if (validate) @@ -275,11 +340,53 @@ public bool Validate() /// /// public void Match( - global::System.Action? easyInputMessage = null, - global::System.Action? message = null, - global::System.Action? itemReference = null, - global::System.Action? functionCall = null, - global::System.Action? functionCallOutput = null, + global::System.Action? easyInputMessage = null, + + global::System.Action? message = null, + + global::System.Action? itemReference = null, + + global::System.Action? functionCall = null, + + global::System.Action? functionCallOutput = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsEasyInputMessage) + { + easyInputMessage?.Invoke(EasyInputMessage!); + } + else if (IsMessage) + { + message?.Invoke(Message!); + } + else if (IsItemReference) + { + itemReference?.Invoke(ItemReference!); + } + else if (IsFunctionCall) + { + functionCall?.Invoke(FunctionCall!); + } + else if (IsFunctionCallOutput) + { + functionCallOutput?.Invoke(FunctionCallOutput!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? easyInputMessage = null, + global::System.Action? message = null, + global::System.Action? itemReference = null, + global::System.Action? functionCall = null, + global::System.Action? functionCallOutput = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs index 1d92138..de997f5 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs @@ -30,6 +30,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(OutputText))] #endif public bool IsOutputText => OutputText != null; + + /// + /// + /// + public bool TryPickOutputText( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseOutputTextContent? value) + { + value = OutputText; + return IsOutputText; + } /// /// /// @@ -87,7 +100,7 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? outputText = null, + global::System.Func? outputText = null, bool validate = true) { if (validate) @@ -107,7 +120,25 @@ public bool Validate() /// /// public void Match( - global::System.Action? outputText = null, + global::System.Action? outputText = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsOutputText) + { + outputText?.Invoke(OutputText!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? outputText = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs index dfa9a34..be36375 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs @@ -31,6 +31,19 @@ namespace Groq #endif public bool IsMessage => Message != null; + /// + /// + /// + public bool TryPickMessage( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseOutputMessage? value) + { + value = Message; + return IsMessage; + } + /// /// A function call generated by the model. /// @@ -48,6 +61,19 @@ namespace Groq #endif public bool IsFunctionCall => FunctionCall != null; + /// + /// + /// + public bool TryPickFunctionCall( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseOutputFunctionCall? value) + { + value = FunctionCall; + return IsFunctionCall; + } + /// /// A reasoning output from the model. Available for [models that support reasoning](https://console.groq.com/docs/reasoning). /// @@ -64,6 +90,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Reasoning))] #endif public bool IsReasoning => Reasoning != null; + + /// + /// + /// + public bool TryPickReasoning( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseOutputReasoning? value) + { + value = Reasoning; + return IsReasoning; + } /// /// /// @@ -165,9 +204,9 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? message = null, - global::System.Func? functionCall = null, - global::System.Func? reasoning = null, + global::System.Func? message = null, + global::System.Func? functionCall = null, + global::System.Func? reasoning = null, bool validate = true) { if (validate) @@ -195,9 +234,39 @@ public bool Validate() /// /// public void Match( - global::System.Action? message = null, - global::System.Action? functionCall = null, - global::System.Action? reasoning = null, + global::System.Action? message = null, + + global::System.Action? functionCall = null, + + global::System.Action? reasoning = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsMessage) + { + message?.Invoke(Message!); + } + else if (IsFunctionCall) + { + functionCall?.Invoke(FunctionCall!); + } + else if (IsReasoning) + { + reasoning?.Invoke(Reasoning!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? message = null, + global::System.Action? functionCall = null, + global::System.Action? reasoning = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs index 11aa6dc..44a988d 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs @@ -31,6 +31,19 @@ namespace Groq #endif public bool IsEnum => Enum != null; + /// + /// + /// + public bool TryPickEnum( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseToolChoiceOptionEnum? value) + { + value = Enum; + return IsEnum; + } + /// /// Specifies a tool the model should use. Use to force the model to call a specific function. /// @@ -47,6 +60,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Named))] #endif public bool IsNamed => Named != null; + + /// + /// + /// + public bool TryPickNamed( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Groq.ResponseNamedToolChoice? value) + { + value = Named; + return IsNamed; + } /// /// /// @@ -124,7 +150,7 @@ public bool Validate() /// public TResult? Match( global::System.Func? @enum = null, - global::System.Func? named = null, + global::System.Func? named = null, bool validate = true) { if (validate) @@ -149,7 +175,31 @@ public bool Validate() /// public void Match( global::System.Action? @enum = null, - global::System.Action? named = null, + + global::System.Action? named = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsEnum) + { + @enum?.Invoke(Enum!); + } + else if (IsNamed) + { + named?.Invoke(Named!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? @enum = null, + global::System.Action? named = null, bool validate = true) { if (validate) diff --git a/src/libs/Groq/Generated/Groq.OneOf.2.g.cs b/src/libs/Groq/Generated/Groq.OneOf.2.g.cs index 926146d..c2d742d 100644 --- a/src/libs/Groq/Generated/Groq.OneOf.2.g.cs +++ b/src/libs/Groq/Generated/Groq.OneOf.2.g.cs @@ -25,6 +25,19 @@ namespace Groq #endif public bool IsValue1 => Value1 != null; + /// + /// + /// + public bool TryPickValue1( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T1? value) + { + value = Value1; + return IsValue1; + } + /// /// /// @@ -41,6 +54,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))] #endif public bool IsValue2 => Value2 != null; + + /// + /// + /// + public bool TryPickValue2( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T2? value) + { + value = Value2; + return IsValue2; + } /// /// /// @@ -143,6 +169,30 @@ public bool Validate() /// 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 void Switch( + global::System.Action? value1 = null, global::System.Action? value2 = null, bool validate = true) { diff --git a/src/libs/Groq/Generated/Groq.OneOf.3.g.cs b/src/libs/Groq/Generated/Groq.OneOf.3.g.cs index d256f14..f2e3730 100644 --- a/src/libs/Groq/Generated/Groq.OneOf.3.g.cs +++ b/src/libs/Groq/Generated/Groq.OneOf.3.g.cs @@ -25,6 +25,19 @@ namespace Groq #endif public bool IsValue1 => Value1 != null; + /// + /// + /// + public bool TryPickValue1( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T1? value) + { + value = Value1; + return IsValue1; + } + /// /// /// @@ -42,6 +55,19 @@ namespace Groq #endif public bool IsValue2 => Value2 != null; + /// + /// + /// + public bool TryPickValue2( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T2? value) + { + value = Value2; + return IsValue2; + } + /// /// /// @@ -58,6 +84,19 @@ namespace Groq [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value3))] #endif public bool IsValue3 => Value3 != null; + + /// + /// + /// + public bool TryPickValue3( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T3? value) + { + value = Value3; + return IsValue3; + } /// /// /// @@ -187,6 +226,36 @@ public bool Validate() /// public void Match( global::System.Action? value1 = null, + + global::System.Action? value2 = null, + + global::System.Action? value3 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsValue1) + { + value1?.Invoke(Value1!); + } + else if (IsValue2) + { + value2?.Invoke(Value2!); + } + else if (IsValue3) + { + value3?.Invoke(Value3!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? value1 = null, global::System.Action? value2 = null, global::System.Action? value3 = null, bool validate = true)