diff --git a/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs b/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs index eeb9580..5ff4647 100644 --- a/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs +++ b/src/libs/Groq/Generated/Groq.AnyOf.2.g.cs @@ -38,6 +38,13 @@ public bool TryPickValue1( return IsValue1; } + /// + /// + /// + public T1 PickValue1() => IsValue1 + ? Value1! + : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}."); + /// /// /// @@ -67,6 +74,13 @@ public bool TryPickValue2( value = Value2; return IsValue2; } + + /// + /// + /// + public T2 PickValue2() => IsValue2 + ? Value2! + : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}."); /// /// /// @@ -85,6 +99,11 @@ public AnyOf(T1? value) Value1 = value; } + /// + /// + /// + public static AnyOf FromValue1(T1? value) => new AnyOf(value); + /// /// /// @@ -103,6 +122,11 @@ public AnyOf(T2? value) Value2 = value; } + /// + /// + /// + public static AnyOf FromValue2(T2? value) => new AnyOf(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs index 8c71730..92b5311 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionDocumentSource.g.cs @@ -44,6 +44,13 @@ public bool TryPickText( return IsText; } + /// + /// + /// + public global::Groq.ChatCompletionDocumentSourceText PickText() => IsText + ? Text! + : throw new global::System.InvalidOperationException($"Expected union variant 'Text' but the value was {ToString()}."); + /// /// A document whose contents are provided inline as JSON data. /// @@ -73,6 +80,13 @@ public bool TryPickJson( value = Json; return IsJson; } + + /// + /// + /// + public global::Groq.ChatCompletionDocumentSourceJSON PickJson() => IsJson + ? Json! + : throw new global::System.InvalidOperationException($"Expected union variant 'Json' but the value was {ToString()}."); /// /// /// @@ -91,6 +105,11 @@ public ChatCompletionDocumentSource(global::Groq.ChatCompletionDocumentSourceTex Text = value; } + /// + /// + /// + public static ChatCompletionDocumentSource FromText(global::Groq.ChatCompletionDocumentSourceText? value) => new ChatCompletionDocumentSource(value); + /// /// /// @@ -109,6 +128,11 @@ public ChatCompletionDocumentSource(global::Groq.ChatCompletionDocumentSourceJSO Json = value; } + /// + /// + /// + public static ChatCompletionDocumentSource FromJson(global::Groq.ChatCompletionDocumentSourceJSON? value) => new ChatCompletionDocumentSource(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs index 52b96b2..19162b4 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs @@ -44,6 +44,13 @@ public bool TryPickSystem( return IsSystem; } + /// + /// + /// + public global::Groq.ChatCompletionRequestSystemMessage PickSystem() => IsSystem + ? System! + : throw new global::System.InvalidOperationException($"Expected union variant 'System' but the value was {ToString()}."); + /// /// /// @@ -74,6 +81,13 @@ public bool TryPickUser( return IsUser; } + /// + /// + /// + public global::Groq.ChatCompletionRequestUserMessage PickUser() => IsUser + ? User! + : throw new global::System.InvalidOperationException($"Expected union variant 'User' but the value was {ToString()}."); + /// /// /// @@ -104,6 +118,13 @@ public bool TryPickAssistant( return IsAssistant; } + /// + /// + /// + public global::Groq.ChatCompletionRequestAssistantMessage PickAssistant() => IsAssistant + ? Assistant! + : throw new global::System.InvalidOperationException($"Expected union variant 'Assistant' but the value was {ToString()}."); + /// /// /// @@ -134,6 +155,13 @@ public bool TryPickTool( return IsTool; } + /// + /// + /// + public global::Groq.ChatCompletionRequestToolMessage PickTool() => IsTool + ? Tool! + : throw new global::System.InvalidOperationException($"Expected union variant 'Tool' but the value was {ToString()}."); + /// /// /// @@ -163,6 +191,13 @@ public bool TryPickFunction( value = Function; return IsFunction; } + + /// + /// + /// + public global::Groq.ChatCompletionRequestFunctionMessage PickFunction() => IsFunction + ? Function! + : throw new global::System.InvalidOperationException($"Expected union variant 'Function' but the value was {ToString()}."); /// /// /// @@ -181,6 +216,11 @@ public ChatCompletionRequestMessage(global::Groq.ChatCompletionRequestSystemMess System = value; } + /// + /// + /// + public static ChatCompletionRequestMessage FromSystem(global::Groq.ChatCompletionRequestSystemMessage? value) => new ChatCompletionRequestMessage(value); + /// /// /// @@ -199,6 +239,11 @@ public ChatCompletionRequestMessage(global::Groq.ChatCompletionRequestUserMessag User = value; } + /// + /// + /// + public static ChatCompletionRequestMessage FromUser(global::Groq.ChatCompletionRequestUserMessage? value) => new ChatCompletionRequestMessage(value); + /// /// /// @@ -217,6 +262,11 @@ public ChatCompletionRequestMessage(global::Groq.ChatCompletionRequestAssistantM Assistant = value; } + /// + /// + /// + public static ChatCompletionRequestMessage FromAssistant(global::Groq.ChatCompletionRequestAssistantMessage? value) => new ChatCompletionRequestMessage(value); + /// /// /// @@ -235,6 +285,11 @@ public ChatCompletionRequestMessage(global::Groq.ChatCompletionRequestToolMessag Tool = value; } + /// + /// + /// + public static ChatCompletionRequestMessage FromTool(global::Groq.ChatCompletionRequestToolMessage? value) => new ChatCompletionRequestMessage(value); + /// /// /// @@ -253,6 +308,11 @@ public ChatCompletionRequestMessage(global::Groq.ChatCompletionRequestFunctionMe Function = value; } + /// + /// + /// + public static ChatCompletionRequestMessage FromFunction(global::Groq.ChatCompletionRequestFunctionMessage? value) => new ChatCompletionRequestMessage(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs index e03abca..0c23f85 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessageContentPart.g.cs @@ -39,6 +39,13 @@ public bool TryPickTextContentPart( return IsTextContentPart; } + /// + /// + /// + public global::Groq.ChatCompletionRequestMessageContentPartText PickTextContentPart() => IsTextContentPart + ? TextContentPart! + : throw new global::System.InvalidOperationException($"Expected union variant 'TextContentPart' but the value was {ToString()}."); + /// /// /// @@ -69,6 +76,13 @@ public bool TryPickImageContentPart( return IsImageContentPart; } + /// + /// + /// + public global::Groq.ChatCompletionRequestMessageContentPartImage PickImageContentPart() => IsImageContentPart + ? ImageContentPart! + : throw new global::System.InvalidOperationException($"Expected union variant 'ImageContentPart' but the value was {ToString()}."); + /// /// /// @@ -98,6 +112,13 @@ public bool TryPickDocumentContentPart( value = DocumentContentPart; return IsDocumentContentPart; } + + /// + /// + /// + public global::Groq.ChatCompletionRequestMessageContentPartDocument PickDocumentContentPart() => IsDocumentContentPart + ? DocumentContentPart! + : throw new global::System.InvalidOperationException($"Expected union variant 'DocumentContentPart' but the value was {ToString()}."); /// /// /// @@ -116,6 +137,11 @@ public ChatCompletionRequestMessageContentPart(global::Groq.ChatCompletionReques TextContentPart = value; } + /// + /// + /// + public static ChatCompletionRequestMessageContentPart FromTextContentPart(global::Groq.ChatCompletionRequestMessageContentPartText? value) => new ChatCompletionRequestMessageContentPart(value); + /// /// /// @@ -134,6 +160,11 @@ public ChatCompletionRequestMessageContentPart(global::Groq.ChatCompletionReques ImageContentPart = value; } + /// + /// + /// + public static ChatCompletionRequestMessageContentPart FromImageContentPart(global::Groq.ChatCompletionRequestMessageContentPartImage? value) => new ChatCompletionRequestMessageContentPart(value); + /// /// /// @@ -152,6 +183,11 @@ public ChatCompletionRequestMessageContentPart(global::Groq.ChatCompletionReques DocumentContentPart = value; } + /// + /// + /// + public static ChatCompletionRequestMessageContentPart FromDocumentContentPart(global::Groq.ChatCompletionRequestMessageContentPartDocument? value) => new ChatCompletionRequestMessageContentPart(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs b/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs index f99d45c..8f961df 100644 --- a/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ChatCompletionToolChoiceOption.g.cs @@ -44,6 +44,13 @@ public bool TryPickEnum( return IsEnum; } + /// + /// + /// + public global::Groq.ChatCompletionToolChoiceOptionEnum PickEnum() => IsEnum + ? Enum!.Value + : throw new global::System.InvalidOperationException($"Expected union variant 'Enum' but the value was {ToString()}."); + /// /// Specifies a tool the model should use. Use to force the model to call a specific function. /// @@ -73,6 +80,13 @@ public bool TryPickNamed( value = Named; return IsNamed; } + + /// + /// + /// + public global::Groq.ChatCompletionNamedToolChoice PickNamed() => IsNamed + ? Named! + : throw new global::System.InvalidOperationException($"Expected union variant 'Named' but the value was {ToString()}."); /// /// /// @@ -91,6 +105,11 @@ public ChatCompletionToolChoiceOption(global::Groq.ChatCompletionToolChoiceOptio Enum = value; } + /// + /// + /// + public static ChatCompletionToolChoiceOption FromEnum(global::Groq.ChatCompletionToolChoiceOptionEnum? value) => new ChatCompletionToolChoiceOption(value); + /// /// /// @@ -109,6 +128,11 @@ public ChatCompletionToolChoiceOption(global::Groq.ChatCompletionNamedToolChoice Named = value; } + /// + /// + /// + public static ChatCompletionToolChoiceOption FromNamed(global::Groq.ChatCompletionNamedToolChoice? value) => new ChatCompletionToolChoiceOption(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs index 39f314c..63ff466 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseAnnotation.g.cs @@ -44,6 +44,13 @@ public bool TryPickFileCitation( return IsFileCitation; } + /// + /// + /// + public global::Groq.ResponseFileCitation PickFileCitation() => IsFileCitation + ? FileCitation! + : throw new global::System.InvalidOperationException($"Expected union variant 'FileCitation' but the value was {ToString()}."); + /// /// A citation for a web resource. /// @@ -73,6 +80,13 @@ public bool TryPickUrlCitation( value = UrlCitation; return IsUrlCitation; } + + /// + /// + /// + public global::Groq.ResponseUrlCitation PickUrlCitation() => IsUrlCitation + ? UrlCitation! + : throw new global::System.InvalidOperationException($"Expected union variant 'UrlCitation' but the value was {ToString()}."); /// /// /// @@ -91,6 +105,11 @@ public ResponseAnnotation(global::Groq.ResponseFileCitation? value) FileCitation = value; } + /// + /// + /// + public static ResponseAnnotation FromFileCitation(global::Groq.ResponseFileCitation? value) => new ResponseAnnotation(value); + /// /// /// @@ -109,6 +128,11 @@ public ResponseAnnotation(global::Groq.ResponseUrlCitation? value) UrlCitation = value; } + /// + /// + /// + public static ResponseAnnotation FromUrlCitation(global::Groq.ResponseUrlCitation? value) => new ResponseAnnotation(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs index 9a87687..2dc8c21 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseFormatConfiguration.g.cs @@ -39,6 +39,13 @@ public bool TryPickText( return IsText; } + /// + /// + /// + public global::Groq.ResponseFormatText PickText() => IsText + ? Text! + : throw new global::System.InvalidOperationException($"Expected union variant 'Text' but the value was {ToString()}."); + /// /// 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. /// @@ -69,6 +76,13 @@ public bool TryPickJsonObject( return IsJsonObject; } + /// + /// + /// + public global::Groq.ResponseFormatJsonObject PickJsonObject() => IsJsonObject + ? JsonObject! + : throw new global::System.InvalidOperationException($"Expected union variant 'JsonObject' but the value was {ToString()}."); + /// /// JSON Schema response format. Used to generate structured JSON responses. /// @@ -98,6 +112,13 @@ public bool TryPickJsonSchema( value = JsonSchema; return IsJsonSchema; } + + /// + /// + /// + public global::Groq.TextResponseFormatJsonSchema PickJsonSchema() => IsJsonSchema + ? JsonSchema! + : throw new global::System.InvalidOperationException($"Expected union variant 'JsonSchema' but the value was {ToString()}."); /// /// /// @@ -116,6 +137,11 @@ public ResponseFormatConfiguration(global::Groq.ResponseFormatText? value) Text = value; } + /// + /// + /// + public static ResponseFormatConfiguration FromText(global::Groq.ResponseFormatText? value) => new ResponseFormatConfiguration(value); + /// /// /// @@ -134,6 +160,11 @@ public ResponseFormatConfiguration(global::Groq.ResponseFormatJsonObject? value) JsonObject = value; } + /// + /// + /// + public static ResponseFormatConfiguration FromJsonObject(global::Groq.ResponseFormatJsonObject? value) => new ResponseFormatConfiguration(value); + /// /// /// @@ -152,6 +183,11 @@ public ResponseFormatConfiguration(global::Groq.TextResponseFormatJsonSchema? va JsonSchema = value; } + /// + /// + /// + public static ResponseFormatConfiguration FromJsonSchema(global::Groq.TextResponseFormatJsonSchema? value) => new ResponseFormatConfiguration(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs index 7add0e3..327802c 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseInputContent.g.cs @@ -43,6 +43,13 @@ public bool TryPickInputText( value = InputText; return IsInputText; } + + /// + /// + /// + public global::Groq.ResponseInputTextContent PickInputText() => IsInputText + ? InputText! + : throw new global::System.InvalidOperationException($"Expected union variant 'InputText' but the value was {ToString()}."); /// /// /// @@ -61,6 +68,11 @@ public ResponseInputContent(global::Groq.ResponseInputTextContent? value) InputText = value; } + /// + /// + /// + public static ResponseInputContent FromInputText(global::Groq.ResponseInputTextContent? value) => new ResponseInputContent(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs index a45c7de..90ccd12 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseInputItem.g.cs @@ -39,6 +39,13 @@ public bool TryPickEasyInputMessage( return IsEasyInputMessage; } + /// + /// + /// + public global::Groq.ResponseEasyInputMessage PickEasyInputMessage() => IsEasyInputMessage + ? EasyInputMessage! + : throw new global::System.InvalidOperationException($"Expected union variant 'EasyInputMessage' but the value was {ToString()}."); + /// /// A message input to the model with explicit type field. /// @@ -69,6 +76,13 @@ public bool TryPickMessage( return IsMessage; } + /// + /// + /// + public global::Groq.ResponseInputMessage PickMessage() => IsMessage + ? Message! + : throw new global::System.InvalidOperationException($"Expected union variant 'Message' but the value was {ToString()}."); + /// /// An internal identifier for an item to reference. /// @@ -99,6 +113,13 @@ public bool TryPickItemReference( return IsItemReference; } + /// + /// + /// + public global::Groq.ResponseItemReference PickItemReference() => IsItemReference + ? ItemReference! + : throw new global::System.InvalidOperationException($"Expected union variant 'ItemReference' but the value was {ToString()}."); + /// /// A function call generated by the model. /// @@ -129,6 +150,13 @@ public bool TryPickFunctionCall( return IsFunctionCall; } + /// + /// + /// + public global::Groq.ResponseFunctionCall PickFunctionCall() => IsFunctionCall + ? FunctionCall! + : throw new global::System.InvalidOperationException($"Expected union variant 'FunctionCall' but the value was {ToString()}."); + /// /// The output of a function tool call. /// @@ -158,6 +186,13 @@ public bool TryPickFunctionCallOutput( value = FunctionCallOutput; return IsFunctionCallOutput; } + + /// + /// + /// + public global::Groq.ResponseFunctionCallOutput PickFunctionCallOutput() => IsFunctionCallOutput + ? FunctionCallOutput! + : throw new global::System.InvalidOperationException($"Expected union variant 'FunctionCallOutput' but the value was {ToString()}."); /// /// /// @@ -176,6 +211,11 @@ public ResponseInputItem(global::Groq.ResponseEasyInputMessage? value) EasyInputMessage = value; } + /// + /// + /// + public static ResponseInputItem FromEasyInputMessage(global::Groq.ResponseEasyInputMessage? value) => new ResponseInputItem(value); + /// /// /// @@ -194,6 +234,11 @@ public ResponseInputItem(global::Groq.ResponseInputMessage? value) Message = value; } + /// + /// + /// + public static ResponseInputItem FromMessage(global::Groq.ResponseInputMessage? value) => new ResponseInputItem(value); + /// /// /// @@ -212,6 +257,11 @@ public ResponseInputItem(global::Groq.ResponseItemReference? value) ItemReference = value; } + /// + /// + /// + public static ResponseInputItem FromItemReference(global::Groq.ResponseItemReference? value) => new ResponseInputItem(value); + /// /// /// @@ -230,6 +280,11 @@ public ResponseInputItem(global::Groq.ResponseFunctionCall? value) FunctionCall = value; } + /// + /// + /// + public static ResponseInputItem FromFunctionCall(global::Groq.ResponseFunctionCall? value) => new ResponseInputItem(value); + /// /// /// @@ -248,6 +303,11 @@ public ResponseInputItem(global::Groq.ResponseFunctionCallOutput? value) FunctionCallOutput = value; } + /// + /// + /// + public static ResponseInputItem FromFunctionCallOutput(global::Groq.ResponseFunctionCallOutput? value) => new ResponseInputItem(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs index de997f5..6c00883 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseOutputContent.g.cs @@ -43,6 +43,13 @@ public bool TryPickOutputText( value = OutputText; return IsOutputText; } + + /// + /// + /// + public global::Groq.ResponseOutputTextContent PickOutputText() => IsOutputText + ? OutputText! + : throw new global::System.InvalidOperationException($"Expected union variant 'OutputText' but the value was {ToString()}."); /// /// /// @@ -61,6 +68,11 @@ public ResponseOutputContent(global::Groq.ResponseOutputTextContent? value) OutputText = value; } + /// + /// + /// + public static ResponseOutputContent FromOutputText(global::Groq.ResponseOutputTextContent? value) => new ResponseOutputContent(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs index be36375..eb7eefd 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseOutputItem.g.cs @@ -44,6 +44,13 @@ public bool TryPickMessage( return IsMessage; } + /// + /// + /// + public global::Groq.ResponseOutputMessage PickMessage() => IsMessage + ? Message! + : throw new global::System.InvalidOperationException($"Expected union variant 'Message' but the value was {ToString()}."); + /// /// A function call generated by the model. /// @@ -74,6 +81,13 @@ public bool TryPickFunctionCall( return IsFunctionCall; } + /// + /// + /// + public global::Groq.ResponseOutputFunctionCall PickFunctionCall() => IsFunctionCall + ? FunctionCall! + : throw new global::System.InvalidOperationException($"Expected union variant 'FunctionCall' but the value was {ToString()}."); + /// /// A reasoning output from the model. Available for [models that support reasoning](https://console.groq.com/docs/reasoning). /// @@ -103,6 +117,13 @@ public bool TryPickReasoning( value = Reasoning; return IsReasoning; } + + /// + /// + /// + public global::Groq.ResponseOutputReasoning PickReasoning() => IsReasoning + ? Reasoning! + : throw new global::System.InvalidOperationException($"Expected union variant 'Reasoning' but the value was {ToString()}."); /// /// /// @@ -121,6 +142,11 @@ public ResponseOutputItem(global::Groq.ResponseOutputMessage? value) Message = value; } + /// + /// + /// + public static ResponseOutputItem FromMessage(global::Groq.ResponseOutputMessage? value) => new ResponseOutputItem(value); + /// /// /// @@ -139,6 +165,11 @@ public ResponseOutputItem(global::Groq.ResponseOutputFunctionCall? value) FunctionCall = value; } + /// + /// + /// + public static ResponseOutputItem FromFunctionCall(global::Groq.ResponseOutputFunctionCall? value) => new ResponseOutputItem(value); + /// /// /// @@ -157,6 +188,11 @@ public ResponseOutputItem(global::Groq.ResponseOutputReasoning? value) Reasoning = value; } + /// + /// + /// + public static ResponseOutputItem FromReasoning(global::Groq.ResponseOutputReasoning? value) => new ResponseOutputItem(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs b/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs index 44a988d..958ad29 100644 --- a/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs +++ b/src/libs/Groq/Generated/Groq.Models.ResponseToolChoiceOption.g.cs @@ -44,6 +44,13 @@ public bool TryPickEnum( return IsEnum; } + /// + /// + /// + public global::Groq.ResponseToolChoiceOptionEnum PickEnum() => IsEnum + ? Enum!.Value + : throw new global::System.InvalidOperationException($"Expected union variant 'Enum' but the value was {ToString()}."); + /// /// Specifies a tool the model should use. Use to force the model to call a specific function. /// @@ -73,6 +80,13 @@ public bool TryPickNamed( value = Named; return IsNamed; } + + /// + /// + /// + public global::Groq.ResponseNamedToolChoice PickNamed() => IsNamed + ? Named! + : throw new global::System.InvalidOperationException($"Expected union variant 'Named' but the value was {ToString()}."); /// /// /// @@ -91,6 +105,11 @@ public ResponseToolChoiceOption(global::Groq.ResponseToolChoiceOptionEnum? value Enum = value; } + /// + /// + /// + public static ResponseToolChoiceOption FromEnum(global::Groq.ResponseToolChoiceOptionEnum? value) => new ResponseToolChoiceOption(value); + /// /// /// @@ -109,6 +128,11 @@ public ResponseToolChoiceOption(global::Groq.ResponseNamedToolChoice? value) Named = value; } + /// + /// + /// + public static ResponseToolChoiceOption FromNamed(global::Groq.ResponseNamedToolChoice? value) => new ResponseToolChoiceOption(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.OneOf.2.g.cs b/src/libs/Groq/Generated/Groq.OneOf.2.g.cs index c2d742d..8a38bda 100644 --- a/src/libs/Groq/Generated/Groq.OneOf.2.g.cs +++ b/src/libs/Groq/Generated/Groq.OneOf.2.g.cs @@ -38,6 +38,13 @@ public bool TryPickValue1( return IsValue1; } + /// + /// + /// + public T1 PickValue1() => IsValue1 + ? Value1! + : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}."); + /// /// /// @@ -67,6 +74,13 @@ public bool TryPickValue2( value = Value2; return IsValue2; } + + /// + /// + /// + public T2 PickValue2() => IsValue2 + ? Value2! + : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}."); /// /// /// @@ -85,6 +99,11 @@ public OneOf(T1? value) Value1 = value; } + /// + /// + /// + public static OneOf FromValue1(T1? value) => new OneOf(value); + /// /// /// @@ -103,6 +122,11 @@ public OneOf(T2? value) Value2 = value; } + /// + /// + /// + public static OneOf FromValue2(T2? value) => new OneOf(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.OneOf.3.g.cs b/src/libs/Groq/Generated/Groq.OneOf.3.g.cs index f2e3730..c2fa525 100644 --- a/src/libs/Groq/Generated/Groq.OneOf.3.g.cs +++ b/src/libs/Groq/Generated/Groq.OneOf.3.g.cs @@ -38,6 +38,13 @@ public bool TryPickValue1( return IsValue1; } + /// + /// + /// + public T1 PickValue1() => IsValue1 + ? Value1! + : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}."); + /// /// /// @@ -68,6 +75,13 @@ public bool TryPickValue2( return IsValue2; } + /// + /// + /// + public T2 PickValue2() => IsValue2 + ? Value2! + : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}."); + /// /// /// @@ -97,6 +111,13 @@ public bool TryPickValue3( value = Value3; return IsValue3; } + + /// + /// + /// + public T3 PickValue3() => IsValue3 + ? Value3! + : throw new global::System.InvalidOperationException($"Expected union variant 'Value3' but the value was {ToString()}."); /// /// /// @@ -115,6 +136,11 @@ public OneOf(T1? value) Value1 = value; } + /// + /// + /// + public static OneOf FromValue1(T1? value) => new OneOf(value); + /// /// /// @@ -133,6 +159,11 @@ public OneOf(T2? value) Value2 = value; } + /// + /// + /// + public static OneOf FromValue2(T2? value) => new OneOf(value); + /// /// /// @@ -151,6 +182,11 @@ public OneOf(T3? value) Value3 = value; } + /// + /// + /// + public static OneOf FromValue3(T3? value) => new OneOf(value); + /// /// /// diff --git a/src/libs/Groq/Generated/Groq.OptionsSupport.g.cs b/src/libs/Groq/Generated/Groq.OptionsSupport.g.cs index 515530a..65d0208 100644 --- a/src/libs/Groq/Generated/Groq.OptionsSupport.g.cs +++ b/src/libs/Groq/Generated/Groq.OptionsSupport.g.cs @@ -54,6 +54,156 @@ public sealed class AutoSDKClientOptions Hooks.Add(hook ?? throw new global::System.ArgumentNullException(nameof(hook))); return this; } + + /// + /// Optional per-request authorization provider invoked before each request is sent. + /// Set this when the client is registered as a singleton in DI but each call needs + /// a fresh credential resolved from a provider, secret-store, or session — instead + /// of mutating the shared Authorizations list at construction time. + /// + public global::Groq.IAutoSDKAuthorizationProvider? AuthorizationProvider { get; set; } + + /// + /// Convenience helper that registers + /// using so request-level auth is resolved without + /// touching shared client state. + /// + /// + public global::Groq.AutoSDKClientOptions UseAuthorizationProvider( + global::Groq.IAutoSDKAuthorizationProvider provider) + { + AuthorizationProvider = provider ?? throw new global::System.ArgumentNullException(nameof(provider)); + if (Hooks.Find(static x => x is global::Groq.AutoSDKAuthorizationProviderHook) == null) + { + Hooks.Add(new global::Groq.AutoSDKAuthorizationProviderHook()); + } + + return this; + } + } + + /// + /// A request-level authorization value supplied by . + /// Mirrors the runtime fields the SDK applies for HTTP / OAuth2 / API-key auth without + /// requiring the consumer to construct the generated EndPointAuthorization type. + /// + public readonly struct AutoSDKAuthorizationValue + { + /// + /// Initializes a new . + /// + /// + /// + /// + /// + /// + public AutoSDKAuthorizationValue( + string value, + string scheme = "Bearer", + string? headerName = null, + string location = "Header", + string type = "Http") + { + Value = value ?? string.Empty; + Scheme = string.IsNullOrWhiteSpace(scheme) ? "Bearer" : scheme; + HeaderName = headerName ?? string.Empty; + Location = string.IsNullOrWhiteSpace(location) ? "Header" : location; + Type = string.IsNullOrWhiteSpace(type) ? "Http" : type; + } + + /// The credential value (token, API key, etc.). + public string Value { get; } + + /// The HTTP authorization scheme — typically Bearer, Basic, or Token. + public string Scheme { get; } + + /// The custom header name when is ApiKey; ignored for HTTP/OAuth2 auth. + public string HeaderName { get; } + + /// The credential location — Header, Query, or Cookie. + public string Location { get; } + + /// The auth type — Http, OAuth2, OpenIdConnect, or ApiKey. + public string Type { get; } + + /// Convenience factory for a Bearer token. + public static global::Groq.AutoSDKAuthorizationValue Bearer(string token) => new(value: token, scheme: "Bearer"); + + /// Convenience factory for an API-key header. + public static global::Groq.AutoSDKAuthorizationValue ApiKeyHeader(string name, string value) => + new(value: value, headerName: name, location: "Header", type: "ApiKey"); + } + + /// + /// Resolves request-level authorization values without mutating the shared client + /// authorization list. Implementations should be safe to invoke concurrently — + /// the hook calls them once per outgoing request. + /// + public interface IAutoSDKAuthorizationProvider + { + /// + /// Returns one or more values to apply to + /// the current request, or an empty list / null to leave the request as-is. + /// + /// + global::System.Threading.Tasks.Task?> ResolveAsync( + global::Groq.AutoSDKHookContext context); + } + + /// + /// Built-in that consults + /// before every outgoing + /// request and stamps the resolved values onto the . + /// + public sealed class AutoSDKAuthorizationProviderHook : global::Groq.AutoSDKHook + { + /// + public override async global::System.Threading.Tasks.Task OnBeforeRequestAsync( + global::Groq.AutoSDKHookContext context) + { + context = context ?? throw new global::System.ArgumentNullException(nameof(context)); + + var provider = context.ClientOptions?.AuthorizationProvider; + if (provider == null || context.Request == null) + { + return; + } + + var resolved = await provider.ResolveAsync(context).ConfigureAwait(false); + if (resolved == null || resolved.Count == 0) + { + return; + } + + for (var index = 0; index < resolved.Count; index++) + { + ApplyAuthorization(context.Request, resolved[index]); + } + } + + private static void ApplyAuthorization( + global::System.Net.Http.HttpRequestMessage request, + global::Groq.AutoSDKAuthorizationValue authorization) + { + switch (authorization.Type) + { + case "Http": + case "OAuth2": + case "OpenIdConnect": + request.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: authorization.Scheme, + parameter: authorization.Value); + break; + case "ApiKey": + if (string.Equals(authorization.Location, "Header", global::System.StringComparison.OrdinalIgnoreCase) && + !string.IsNullOrEmpty(authorization.HeaderName)) + { + request.Headers.Remove(authorization.HeaderName); + request.Headers.TryAddWithoutValidation(authorization.HeaderName, authorization.Value ?? string.Empty); + } + break; + } + } } ///