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 @@ -23,9 +23,7 @@ public partial interface ISubpackageBetaResponsesClient
/// </summary>
/// <param name="background"></param>
/// <param name="frequencyPenalty"></param>
/// <param name="imageConfig">
/// Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details.
/// </param>
/// <param name="imageConfig"></param>
/// <param name="include"></param>
/// <param name="input">
/// Input for a response request - can be a string or array of items
Expand Down Expand Up @@ -89,7 +87,7 @@ public partial interface ISubpackageBetaResponsesClient
global::System.Threading.Tasks.Task<global::OpenRouter.OpenResponsesResult> CreateResponsesAsync(
bool? background = default,
double? frequencyPenalty = default,
object? imageConfig = default,
global::OpenRouter.ImageConfig? imageConfig = default,
global::System.Collections.Generic.IList<global::OpenRouter.ResponseIncludesEnum>? include = default,
global::OpenRouter.Inputs? input = default,
string? instructions = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public partial interface ISubpackageChatClient
/// <param name="frequencyPenalty">
/// Frequency penalty (-2.0 to 2.0)
/// </param>
/// <param name="imageConfig">
/// Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
/// </param>
/// <param name="imageConfig"></param>
/// <param name="logitBias">
/// Token logit bias adjustments
/// </param>
Expand Down Expand Up @@ -127,7 +125,7 @@ public partial interface ISubpackageChatClient
global::OpenRouter.ChatRequestCacheControl? cacheControl = default,
global::OpenRouter.ChatDebugOptions? debug = default,
double? frequencyPenalty = default,
object? imageConfig = default,
global::OpenRouter.ImageConfig? imageConfig = default,
global::System.Collections.Generic.Dictionary<string, double>? logitBias = default,
bool? logprobs = default,
int? maxCompletionTokens = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,30 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat
if (__jsonProps.Contains("parameters")) __score3++;
if (__jsonProps.Contains("type")) __score3++;
var __score4 = 0;
if (__jsonProps.Contains("allowed_domains")) __score4++;
if (__jsonProps.Contains("engine")) __score4++;
if (__jsonProps.Contains("excluded_domains")) __score4++;
if (__jsonProps.Contains("max_results")) __score4++;
if (__jsonProps.Contains("max_total_results")) __score4++;
if (__jsonProps.Contains("parameters")) __score4++;
if (__jsonProps.Contains("search_context_size")) __score4++;
if (__jsonProps.Contains("type")) __score4++;
if (__jsonProps.Contains("user_location")) __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("search_context_size")) __score5++;
if (__jsonProps.Contains("type")) __score5++;
if (__jsonProps.Contains("user_location")) __score5++;
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; }
if (__score5 > __bestScore) { __bestScore = __score5; __bestIndex = 5; }

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

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

try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenRouter.ImageGenerationServerToolOpenRouter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.ImageGenerationServerToolOpenRouter> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenRouter.ImageGenerationServerToolOpenRouter).Name}");
imageGenerationServerToolOpenRouter = 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.ChatSearchModelsServerTool), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenRouter.ChatSearchModelsServerTool> ??
Expand Down Expand Up @@ -214,6 +247,8 @@ public class ChatFunctionToolJsonConverter : global::System.Text.Json.Serializat

datetimeServerTool,

imageGenerationServerToolOpenRouter,

chatSearchModelsServerTool,

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