Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/libs/Groq/Generated/Groq.AnyOf.2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ namespace Groq
#endif
public bool IsValue1 => Value1 != null;

/// <summary>
///
/// </summary>
public bool TryPickValue1(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out T1? value)
{
value = Value1;
return IsValue1;
}

/// <summary>
///
/// </summary>
Expand All @@ -41,6 +54,19 @@ namespace Groq
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
#endif
public bool IsValue2 => Value2 != null;

/// <summary>
///
/// </summary>
public bool TryPickValue2(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out T2? value)
{
value = Value2;
return IsValue2;
}
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -143,6 +169,30 @@ public bool Validate()
/// </summary>
public void Match(
global::System.Action<T1>? value1 = null,

global::System.Action<T2>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1)
{
value1?.Invoke(Value1!);
}
else if (IsValue2)
{
value2?.Invoke(Value2!);
}
}

/// <summary>
///
/// </summary>
public void Switch(
global::System.Action<T1>? value1 = null,
global::System.Action<T2>? value2 = null,
bool validate = true)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ partial void Authorizing(
ref string apiKey);
partial void Authorized(
global::System.Net.Http.HttpClient client);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ namespace Groq
#endif
public bool IsText => Text != null;

/// <summary>
///
/// </summary>
public bool TryPickText(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::Groq.ChatCompletionDocumentSourceText? value)
{
value = Text;
return IsText;
}

/// <summary>
/// A document whose contents are provided inline as JSON data.
/// </summary>
Expand All @@ -47,6 +60,19 @@ namespace Groq
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Json))]
#endif
public bool IsJson => Json != null;

/// <summary>
///
/// </summary>
public bool TryPickJson(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::Groq.ChatCompletionDocumentSourceJSON? value)
{
value = Json;
return IsJson;
}
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -126,8 +152,8 @@ public bool Validate()
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<global::Groq.ChatCompletionDocumentSourceText?, TResult>? text = null,
global::System.Func<global::Groq.ChatCompletionDocumentSourceJSON?, TResult>? json = null,
global::System.Func<global::Groq.ChatCompletionDocumentSourceText, TResult>? text = null,
global::System.Func<global::Groq.ChatCompletionDocumentSourceJSON, TResult>? json = null,
bool validate = true)
{
if (validate)
Expand All @@ -151,8 +177,32 @@ public bool Validate()
///
/// </summary>
public void Match(
global::System.Action<global::Groq.ChatCompletionDocumentSourceText?>? text = null,
global::System.Action<global::Groq.ChatCompletionDocumentSourceJSON?>? json = null,
global::System.Action<global::Groq.ChatCompletionDocumentSourceText>? text = null,

global::System.Action<global::Groq.ChatCompletionDocumentSourceJSON>? json = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsText)
{
text?.Invoke(Text!);
}
else if (IsJson)
{
json?.Invoke(Json!);
}
}

/// <summary>
///
/// </summary>
public void Switch(
global::System.Action<global::Groq.ChatCompletionDocumentSourceText>? text = null,
global::System.Action<global::Groq.ChatCompletionDocumentSourceJSON>? json = null,
bool validate = true)
{
if (validate)
Expand Down
127 changes: 117 additions & 10 deletions src/libs/Groq/Generated/Groq.Models.ChatCompletionRequestMessage.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ namespace Groq
#endif
public bool IsSystem => System != null;

/// <summary>
///
/// </summary>
public bool TryPickSystem(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::Groq.ChatCompletionRequestSystemMessage? value)
{
value = System;
return IsSystem;
}

/// <summary>
///
/// </summary>
Expand All @@ -48,6 +61,19 @@ namespace Groq
#endif
public bool IsUser => User != null;

/// <summary>
///
/// </summary>
public bool TryPickUser(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::Groq.ChatCompletionRequestUserMessage? value)
{
value = User;
return IsUser;
}

/// <summary>
///
/// </summary>
Expand All @@ -65,6 +91,19 @@ namespace Groq
#endif
public bool IsAssistant => Assistant != null;

/// <summary>
///
/// </summary>
public bool TryPickAssistant(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::Groq.ChatCompletionRequestAssistantMessage? value)
{
value = Assistant;
return IsAssistant;
}

/// <summary>
///
/// </summary>
Expand All @@ -82,6 +121,19 @@ namespace Groq
#endif
public bool IsTool => Tool != null;

/// <summary>
///
/// </summary>
public bool TryPickTool(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::Groq.ChatCompletionRequestToolMessage? value)
{
value = Tool;
return IsTool;
}

/// <summary>
///
/// </summary>
Expand All @@ -98,6 +150,19 @@ namespace Groq
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Function))]
#endif
public bool IsFunction => Function != null;

/// <summary>
///
/// </summary>
public bool TryPickFunction(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::Groq.ChatCompletionRequestFunctionMessage? value)
{
value = Function;
return IsFunction;
}
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -243,11 +308,11 @@ public bool Validate()
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<global::Groq.ChatCompletionRequestSystemMessage?, TResult>? system = null,
global::System.Func<global::Groq.ChatCompletionRequestUserMessage?, TResult>? user = null,
global::System.Func<global::Groq.ChatCompletionRequestAssistantMessage?, TResult>? assistant = null,
global::System.Func<global::Groq.ChatCompletionRequestToolMessage?, TResult>? tool = null,
global::System.Func<global::Groq.ChatCompletionRequestFunctionMessage?, TResult>? function = null,
global::System.Func<global::Groq.ChatCompletionRequestSystemMessage, TResult>? system = null,
global::System.Func<global::Groq.ChatCompletionRequestUserMessage, TResult>? user = null,
global::System.Func<global::Groq.ChatCompletionRequestAssistantMessage, TResult>? assistant = null,
global::System.Func<global::Groq.ChatCompletionRequestToolMessage, TResult>? tool = null,
global::System.Func<global::Groq.ChatCompletionRequestFunctionMessage, TResult>? function = null,
bool validate = true)
{
if (validate)
Expand Down Expand Up @@ -283,11 +348,53 @@ public bool Validate()
///
/// </summary>
public void Match(
global::System.Action<global::Groq.ChatCompletionRequestSystemMessage?>? system = null,
global::System.Action<global::Groq.ChatCompletionRequestUserMessage?>? user = null,
global::System.Action<global::Groq.ChatCompletionRequestAssistantMessage?>? assistant = null,
global::System.Action<global::Groq.ChatCompletionRequestToolMessage?>? tool = null,
global::System.Action<global::Groq.ChatCompletionRequestFunctionMessage?>? function = null,
global::System.Action<global::Groq.ChatCompletionRequestSystemMessage>? system = null,

global::System.Action<global::Groq.ChatCompletionRequestUserMessage>? user = null,

global::System.Action<global::Groq.ChatCompletionRequestAssistantMessage>? assistant = null,

global::System.Action<global::Groq.ChatCompletionRequestToolMessage>? tool = null,

global::System.Action<global::Groq.ChatCompletionRequestFunctionMessage>? 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!);
}
}

/// <summary>
///
/// </summary>
public void Switch(
global::System.Action<global::Groq.ChatCompletionRequestSystemMessage>? system = null,
global::System.Action<global::Groq.ChatCompletionRequestUserMessage>? user = null,
global::System.Action<global::Groq.ChatCompletionRequestAssistantMessage>? assistant = null,
global::System.Action<global::Groq.ChatCompletionRequestToolMessage>? tool = null,
global::System.Action<global::Groq.ChatCompletionRequestFunctionMessage>? function = null,
bool validate = true)
{
if (validate)
Expand Down
Loading