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 @@ -59,19 +59,12 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
var __score4 = 0;
if (__jsonProps.Contains("parameters")) __score4++;
if (__jsonProps.Contains("parameters.allowed_domains")) __score4++;
if (__jsonProps.Contains("parameters.blocked_domains")) __score4++;
if (__jsonProps.Contains("parameters.engine")) __score4++;
if (__jsonProps.Contains("parameters.excluded_domains")) __score4++;
if (__jsonProps.Contains("parameters.max_results")) __score4++;
if (__jsonProps.Contains("parameters.max_total_results")) __score4++;
if (__jsonProps.Contains("parameters.search_context_size")) __score4++;
if (__jsonProps.Contains("parameters.user_location")) __score4++;
if (__jsonProps.Contains("parameters.max_content_tokens")) __score4++;
if (__jsonProps.Contains("parameters.max_uses")) __score4++;
if (__jsonProps.Contains("type")) __score4++;
var __score5 = 0;
if (__jsonProps.Contains("allowed_domains")) __score5++;
if (__jsonProps.Contains("engine")) __score5++;
if (__jsonProps.Contains("excluded_domains")) __score5++;
if (__jsonProps.Contains("max_results")) __score5++;
if (__jsonProps.Contains("max_total_results")) __score5++;
if (__jsonProps.Contains("parameters")) __score5++;
if (__jsonProps.Contains("parameters.allowed_domains")) __score5++;
if (__jsonProps.Contains("parameters.engine")) __score5++;
Expand All @@ -80,14 +73,29 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
if (__jsonProps.Contains("parameters.max_total_results")) __score5++;
if (__jsonProps.Contains("parameters.search_context_size")) __score5++;
if (__jsonProps.Contains("parameters.user_location")) __score5++;
if (__jsonProps.Contains("search_context_size")) __score5++;
if (__jsonProps.Contains("type")) __score5++;
if (__jsonProps.Contains("user_location")) __score5++;
if (__jsonProps.Contains("user_location.city")) __score5++;
if (__jsonProps.Contains("user_location.country")) __score5++;
if (__jsonProps.Contains("user_location.region")) __score5++;
if (__jsonProps.Contains("user_location.timezone")) __score5++;
if (__jsonProps.Contains("user_location.type")) __score5++;
var __score6 = 0;
if (__jsonProps.Contains("allowed_domains")) __score6++;
if (__jsonProps.Contains("engine")) __score6++;
if (__jsonProps.Contains("excluded_domains")) __score6++;
if (__jsonProps.Contains("max_results")) __score6++;
if (__jsonProps.Contains("max_total_results")) __score6++;
if (__jsonProps.Contains("parameters")) __score6++;
if (__jsonProps.Contains("parameters.allowed_domains")) __score6++;
if (__jsonProps.Contains("parameters.engine")) __score6++;
if (__jsonProps.Contains("parameters.excluded_domains")) __score6++;
if (__jsonProps.Contains("parameters.max_results")) __score6++;
if (__jsonProps.Contains("parameters.max_total_results")) __score6++;
if (__jsonProps.Contains("parameters.search_context_size")) __score6++;
if (__jsonProps.Contains("parameters.user_location")) __score6++;
if (__jsonProps.Contains("search_context_size")) __score6++;
if (__jsonProps.Contains("type")) __score6++;
if (__jsonProps.Contains("user_location")) __score6++;
if (__jsonProps.Contains("user_location.city")) __score6++;
if (__jsonProps.Contains("user_location.country")) __score6++;
if (__jsonProps.Contains("user_location.region")) __score6++;
if (__jsonProps.Contains("user_location.timezone")) __score6++;
if (__jsonProps.Contains("user_location.type")) __score6++;
var __bestScore = 0;
var __bestIndex = -1;
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
Expand All @@ -96,11 +104,13 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
if (__score3 > __bestScore) { __bestScore = __score3; __bestIndex = 3; }
if (__score4 > __bestScore) { __bestScore = __score4; __bestIndex = 4; }
if (__score5 > __bestScore) { __bestScore = __score5; __bestIndex = 5; }
if (__score6 > __bestScore) { __bestScore = __score6; __bestIndex = 6; }

global::OpenRouter.ChatFunctionTool0? chatFunctionTool0 = default;
global::OpenRouter.DatetimeServerTool? datetimeServerTool = default;
global::OpenRouter.ImageGenerationServerToolOpenRouter? imageGenerationServerToolOpenRouter = default;
global::OpenRouter.ChatSearchModelsServerTool? chatSearchModelsServerTool = default;
global::OpenRouter.WebFetchServerTool? webFetchServerTool = default;
global::OpenRouter.OpenRouterWebSearchServerTool? openRouterWebSearchServerTool = default;
global::OpenRouter.ChatWebSearchShorthand? chatWebSearchShorthand = default;
if (__bestIndex >= 0)
Expand Down Expand Up @@ -166,6 +176,21 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
}
}
else if (__bestIndex == 4)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.WebFetchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.WebFetchServerTool> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.WebFetchServerTool).Name}");
webFetchServerTool = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}
else if (__bestIndex == 5)
{
try
{
Expand All @@ -180,7 +205,7 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
{
}
}
else if (__bestIndex == 5)
else if (__bestIndex == 6)
{
try
{
Expand All @@ -197,7 +222,7 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
}
}

if (chatFunctionTool0 == null && datetimeServerTool == null && imageGenerationServerToolOpenRouter == null && chatSearchModelsServerTool == null && openRouterWebSearchServerTool == null && chatWebSearchShorthand == null)
if (chatFunctionTool0 == null && datetimeServerTool == null && imageGenerationServerToolOpenRouter == null && chatSearchModelsServerTool == null && webFetchServerTool == null && openRouterWebSearchServerTool == null && chatWebSearchShorthand == null)
{
try
{
Expand Down Expand Up @@ -251,6 +276,19 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
{
}

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

try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.OpenRouterWebSearchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.OpenRouterWebSearchServerTool> ??
Expand Down Expand Up @@ -287,6 +325,8 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat

chatSearchModelsServerTool,

webFetchServerTool,

openRouterWebSearchServerTool,

chatWebSearchShorthand
Expand Down Expand Up @@ -328,6 +368,12 @@ public override void Write(
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.ChatSearchModelsServerTool).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.ChatSearchModelsServerTool!, typeInfo);
}
else if (value.IsWebFetchServerTool)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.WebFetchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.WebFetchServerTool?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.WebFetchServerTool).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.WebFetchServerTool!, typeInfo);
}
else if (value.IsOpenRouterWebSearchServerTool)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.OpenRouterWebSearchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.OpenRouterWebSearchServerTool?> ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,21 @@ public class MessagesRequestToolsItemsJsonConverter : global::System.Text.Json.S
var __score8 = 0;
if (__jsonProps.Contains("parameters")) __score8++;
if (__jsonProps.Contains("parameters.allowed_domains")) __score8++;
if (__jsonProps.Contains("parameters.blocked_domains")) __score8++;
if (__jsonProps.Contains("parameters.engine")) __score8++;
if (__jsonProps.Contains("parameters.excluded_domains")) __score8++;
if (__jsonProps.Contains("parameters.max_results")) __score8++;
if (__jsonProps.Contains("parameters.max_total_results")) __score8++;
if (__jsonProps.Contains("parameters.search_context_size")) __score8++;
if (__jsonProps.Contains("parameters.user_location")) __score8++;
if (__jsonProps.Contains("parameters.max_content_tokens")) __score8++;
if (__jsonProps.Contains("parameters.max_uses")) __score8++;
if (__jsonProps.Contains("type")) __score8++;
var __score9 = 0;
if (__jsonProps.Contains("parameters")) __score9++;
if (__jsonProps.Contains("parameters.allowed_domains")) __score9++;
if (__jsonProps.Contains("parameters.engine")) __score9++;
if (__jsonProps.Contains("parameters.excluded_domains")) __score9++;
if (__jsonProps.Contains("parameters.max_results")) __score9++;
if (__jsonProps.Contains("parameters.max_total_results")) __score9++;
if (__jsonProps.Contains("parameters.search_context_size")) __score9++;
if (__jsonProps.Contains("parameters.user_location")) __score9++;
if (__jsonProps.Contains("type")) __score9++;
var __bestScore = 0;
var __bestIndex = -1;
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
Expand All @@ -121,6 +129,7 @@ public class MessagesRequestToolsItemsJsonConverter : global::System.Text.Json.S
if (__score6 > __bestScore) { __bestScore = __score6; __bestIndex = 6; }
if (__score7 > __bestScore) { __bestScore = __score7; __bestIndex = 7; }
if (__score8 > __bestScore) { __bestScore = __score8; __bestIndex = 8; }
if (__score9 > __bestScore) { __bestScore = __score9; __bestIndex = 9; }

global::OpenRouter.MessagesRequestToolsItems0? messagesRequestToolsItems0 = default;
global::OpenRouter.MessagesRequestToolsItems1? messagesRequestToolsItems1 = default;
Expand All @@ -130,6 +139,7 @@ public class MessagesRequestToolsItemsJsonConverter : global::System.Text.Json.S
global::OpenRouter.DatetimeServerTool? datetimeServerTool = default;
global::OpenRouter.ImageGenerationServerToolOpenRouter? imageGenerationServerToolOpenRouter = default;
global::OpenRouter.ChatSearchModelsServerTool? chatSearchModelsServerTool = default;
global::OpenRouter.WebFetchServerTool? webFetchServerTool = default;
global::OpenRouter.OpenRouterWebSearchServerTool? openRouterWebSearchServerTool = default;
if (__bestIndex >= 0)
{
Expand Down Expand Up @@ -254,6 +264,21 @@ public class MessagesRequestToolsItemsJsonConverter : global::System.Text.Json.S
}
}
else if (__bestIndex == 8)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.WebFetchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.WebFetchServerTool> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.WebFetchServerTool).Name}");
webFetchServerTool = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}
else if (__bestIndex == 9)
{
try
{
Expand All @@ -270,7 +295,7 @@ public class MessagesRequestToolsItemsJsonConverter : global::System.Text.Json.S
}
}

if (messagesRequestToolsItems0 == null && messagesRequestToolsItems1 == null && messagesRequestToolsItems2 == null && messagesRequestToolsItems3 == null && messagesRequestToolsItems4 == null && datetimeServerTool == null && imageGenerationServerToolOpenRouter == null && chatSearchModelsServerTool == null && openRouterWebSearchServerTool == null)
if (messagesRequestToolsItems0 == null && messagesRequestToolsItems1 == null && messagesRequestToolsItems2 == null && messagesRequestToolsItems3 == null && messagesRequestToolsItems4 == null && datetimeServerTool == null && imageGenerationServerToolOpenRouter == null && chatSearchModelsServerTool == null && webFetchServerTool == null && openRouterWebSearchServerTool == null)
{
try
{
Expand Down Expand Up @@ -376,6 +401,19 @@ public class MessagesRequestToolsItemsJsonConverter : global::System.Text.Json.S
{
}

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

try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.OpenRouterWebSearchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.OpenRouterWebSearchServerTool> ??
Expand Down Expand Up @@ -407,6 +445,8 @@ public class MessagesRequestToolsItemsJsonConverter : global::System.Text.Json.S

chatSearchModelsServerTool,

webFetchServerTool,

openRouterWebSearchServerTool
);

Expand Down Expand Up @@ -470,6 +510,12 @@ public override void Write(
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.ChatSearchModelsServerTool).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.ChatSearchModelsServerTool!, typeInfo);
}
else if (value.IsWebFetchServerTool)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.WebFetchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.WebFetchServerTool?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.WebFetchServerTool).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.WebFetchServerTool!, typeInfo);
}
else if (value.IsOpenRouterWebSearchServerTool)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.OpenRouterWebSearchServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.OpenRouterWebSearchServerTool?> ??
Expand Down
Loading
Loading