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
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,21 @@ public class ChatToolChoiceJsonConverter : global::System.Text.Json.Serializatio
if (__jsonProps.Contains("function")) __score3++;
if (__jsonProps.Contains("function.name")) __score3++;
if (__jsonProps.Contains("type")) __score3++;
var __score4 = 0;
if (__jsonProps.Contains("type")) __score4++;
var __bestScore = 0;
var __bestIndex = -1;
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }
if (__score2 > __bestScore) { __bestScore = __score2; __bestIndex = 2; }
if (__score3 > __bestScore) { __bestScore = __score3; __bestIndex = 3; }
if (__score4 > __bestScore) { __bestScore = __score4; __bestIndex = 4; }

global::OpenRouter.ChatToolChoice0? chatToolChoice0 = default;
global::OpenRouter.ChatToolChoice1? chatToolChoice1 = default;
global::OpenRouter.ChatToolChoice2? chatToolChoice2 = default;
global::OpenRouter.ChatNamedToolChoice? chatNamedToolChoice = default;
global::OpenRouter.ChatServerToolChoice? chatServerToolChoice = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand Down Expand Up @@ -114,9 +118,24 @@ public class ChatToolChoiceJsonConverter : global::System.Text.Json.Serializatio
{
}
}
else if (__bestIndex == 4)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.ChatServerToolChoice), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.ChatServerToolChoice> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.ChatServerToolChoice).Name}");
chatServerToolChoice = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}
}

if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null)
if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null && chatServerToolChoice == null)
{
try
{
Expand All @@ -133,7 +152,7 @@ public class ChatToolChoiceJsonConverter : global::System.Text.Json.Serializatio
}
}

if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null)
if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null && chatServerToolChoice == null)
{
try
{
Expand All @@ -150,7 +169,7 @@ public class ChatToolChoiceJsonConverter : global::System.Text.Json.Serializatio
}
}

if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null)
if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null && chatServerToolChoice == null)
{
try
{
Expand All @@ -167,7 +186,7 @@ public class ChatToolChoiceJsonConverter : global::System.Text.Json.Serializatio
}
}

if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null)
if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null && chatServerToolChoice == null)
{
try
{
Expand All @@ -184,14 +203,33 @@ public class ChatToolChoiceJsonConverter : global::System.Text.Json.Serializatio
}
}

if (chatToolChoice0 == null && chatToolChoice1 == null && chatToolChoice2 == null && chatNamedToolChoice == null && chatServerToolChoice == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.ChatServerToolChoice), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.ChatServerToolChoice> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.ChatServerToolChoice).Name}");
chatServerToolChoice = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}

var __value = new global::OpenRouter.ChatToolChoice(
chatToolChoice0,

chatToolChoice1,

chatToolChoice2,

chatNamedToolChoice
chatNamedToolChoice,

chatServerToolChoice
);

return __value;
Expand Down Expand Up @@ -230,6 +268,12 @@ public override void Write(
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.ChatNamedToolChoice).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.ChatNamedToolChoice!, typeInfo);
}
else if (value.IsChatServerToolChoice)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.ChatServerToolChoice), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.ChatServerToolChoice?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.ChatServerToolChoice).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.ChatServerToolChoice!, typeInfo);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6129,6 +6129,7 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.ChatNamedToolChoiceFunction))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.ChatNamedToolChoiceType), TypeInfoPropertyName = "ChatNamedToolChoiceType2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.ChatNamedToolChoice))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.ChatServerToolChoice))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.ChatToolChoice), TypeInfoPropertyName = "ChatToolChoice2_3")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.ChatFunctionToolOneOf0Function))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.ChatFunctionToolOneOf0Type), TypeInfoPropertyName = "ChatFunctionToolOneOf0Type2")]
Expand Down Expand Up @@ -6331,7 +6332,6 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant1))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant1Type), TypeInfoPropertyName = "AnthropicTextBlockParamCitationsItemsVariant1Type2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant2))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant2Type), TypeInfoPropertyName = "AnthropicTextBlockParamCitationsItemsVariant2Type2")]
internal sealed partial class SourceGenerationContextChunk1 : global::System.Text.Json.Serialization.JsonSerializerContext
{
}
Expand Down Expand Up @@ -8997,6 +8997,7 @@ internal sealed partial class SourceGenerationContextChunk1 : global::System.Tex

typeof(global::OpenRouter.JsonConverters.UnixTimestampJsonConverter),
})]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant2Type), TypeInfoPropertyName = "AnthropicTextBlockParamCitationsItemsVariant2Type2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant3))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant3Type), TypeInfoPropertyName = "AnthropicTextBlockParamCitationsItemsVariant3Type2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.AnthropicTextBlockParamCitationsItemsVariant4))]
Expand Down Expand Up @@ -9496,7 +9497,6 @@ internal sealed partial class SourceGenerationContextChunk1 : global::System.Tex
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant9Type), TypeInfoPropertyName = "UpdateObservabilityDestinationResponseDataVariant9Type2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant10))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant10Type), TypeInfoPropertyName = "UpdateObservabilityDestinationResponseDataVariant10Type2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant11))]
internal sealed partial class SourceGenerationContextChunk2 : global::System.Text.Json.Serialization.JsonSerializerContext
{
}
Expand Down Expand Up @@ -12162,6 +12162,7 @@ internal sealed partial class SourceGenerationContextChunk2 : global::System.Tex

typeof(global::OpenRouter.JsonConverters.UnixTimestampJsonConverter),
})]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant11))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant11Type), TypeInfoPropertyName = "UpdateObservabilityDestinationResponseDataVariant11Type2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant12))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::OpenRouter.UpdateObservabilityDestinationResponseDataVariant12Type), TypeInfoPropertyName = "UpdateObservabilityDestinationResponseDataVariant12Type2")]
Expand Down
Loading