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 @@ -21,32 +21,12 @@ internal static partial class ModelRouterCreateGenerateAudioCommandApiCommand
Required = true,
};

private static Option<bool?> DryRun { get; } = CliRuntime.CreateNullableBoolOption(
name: @"--dry-run",
description: @"When true, run the full routing pipeline and return the decision and estimated cost without generating. No task is created, nothing is billed, and no asset is produced.");

private static Option<global::Runway.CreateGenerateAudioRequestInput> InputOption { get; } = new(
name: @"--input")
{
Description = @"Model-agnostic audio generation input. The router selects a model and maps these options to it.",
Required = true,
};
private static Option<string?> RequestInput { get; } = new(@"--request-input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
};

private static Option<string?> RequestJson { get; } = new(@"--request-json")
{
Description = "Request body as JSON.",
Hidden = true,
};

private static Option<string?> RequestFile { get; } = new(@"--request-file")
{
Description = "Path to a JSON request file, or '-' for stdin.",
Hidden = true,
};

private static string FormatResponse(ParseResult parseResult, global::Runway.CreateGenerateAudioResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
Expand Down Expand Up @@ -74,44 +54,21 @@ public static Command Create()
Start an audio generation task using a saved Model Router config instead of naming a model. Set input.type to speech to speak promptText verbatim, or audio to generate audio described by promptText.");
command.Options.Add(XRunwayVersion);
command.Options.Add(ConfigId);
command.Options.Add(DryRun);
command.Options.Add(InputOption);
command.Options.Add(RequestInput);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
command.Validators.Add(result =>
{
var hasInput = result.GetResult(RequestInput) is not null;
var hasRequestJson = result.GetResult(RequestJson) is not null;
var hasRequestFile = result.GetResult(RequestFile) is not null;
var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0);
if (specifiedCount > 1)
{
result.AddError(@"Specify at most one of --request-input, --request-json, or --request-file.");
}
});


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync<global::Runway.CreateGenerateAudioRequest>(
parseResult,
RequestInput,
RequestJson,
RequestFile,
global::Runway.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var xRunwayVersion = parseResult.GetRequiredValue(XRunwayVersion);
var configId = parseResult.GetRequiredValue(ConfigId);
var dryRun = CliRuntime.WasSpecified(parseResult, DryRun) ? parseResult.GetValue(DryRun) : (__requestBase is { } __DryRunBaseValue ? __DryRunBaseValue.DryRun : default);
var input = parseResult.GetRequiredValue(InputOption);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.ModelRouter.CreateGenerateAudioAsync(
xRunwayVersion: xRunwayVersion,
configId: configId,
dryRun: dryRun,
input: input,
cancellationToken: cancellationToken).ConfigureAwait(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,12 @@ internal static partial class ModelRouterCreateGenerateImageCommandApiCommand
Required = true,
};

private static Option<bool?> DryRun { get; } = CliRuntime.CreateNullableBoolOption(
name: @"--dry-run",
description: @"When true, run the full routing pipeline and return the decision and estimated cost without generating. No task is created, nothing is billed, and no asset is produced.");

private static Option<global::Runway.CreateGenerateImageRequestInput> InputOption { get; } = new(
name: @"--input")
{
Description = @"Model-agnostic image generation input. The router selects a model and maps these options to it.",
Required = true,
};
private static Option<string?> RequestInput { get; } = new(@"--request-input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
};

private static Option<string?> RequestJson { get; } = new(@"--request-json")
{
Description = "Request body as JSON.",
Hidden = true,
};

private static Option<string?> RequestFile { get; } = new(@"--request-file")
{
Description = "Path to a JSON request file, or '-' for stdin.",
Hidden = true,
};

private static string FormatResponse(ParseResult parseResult, global::Runway.CreateGenerateImageResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
Expand Down Expand Up @@ -74,44 +54,21 @@ public static Command Create()
Start an image generation task using a saved Model Router config instead of naming a model.");
command.Options.Add(XRunwayVersion);
command.Options.Add(ConfigId);
command.Options.Add(DryRun);
command.Options.Add(InputOption);
command.Options.Add(RequestInput);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
command.Validators.Add(result =>
{
var hasInput = result.GetResult(RequestInput) is not null;
var hasRequestJson = result.GetResult(RequestJson) is not null;
var hasRequestFile = result.GetResult(RequestFile) is not null;
var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0);
if (specifiedCount > 1)
{
result.AddError(@"Specify at most one of --request-input, --request-json, or --request-file.");
}
});


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync<global::Runway.CreateGenerateImageRequest>(
parseResult,
RequestInput,
RequestJson,
RequestFile,
global::Runway.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var xRunwayVersion = parseResult.GetRequiredValue(XRunwayVersion);
var configId = parseResult.GetRequiredValue(ConfigId);
var dryRun = CliRuntime.WasSpecified(parseResult, DryRun) ? parseResult.GetValue(DryRun) : (__requestBase is { } __DryRunBaseValue ? __DryRunBaseValue.DryRun : default);
var input = parseResult.GetRequiredValue(InputOption);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.ModelRouter.CreateGenerateImageAsync(
xRunwayVersion: xRunwayVersion,
configId: configId,
dryRun: dryRun,
input: input,
cancellationToken: cancellationToken).ConfigureAwait(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,12 @@ internal static partial class ModelRouterCreateGenerateVideoCommandApiCommand
Required = true,
};

private static Option<bool?> DryRun { get; } = CliRuntime.CreateNullableBoolOption(
name: @"--dry-run",
description: @"When true, run the full routing pipeline and return the decision and estimated cost without generating. No task is created, nothing is billed, and no asset is produced.");

private static Option<global::Runway.CreateGenerateVideoRequestInput> InputOption { get; } = new(
name: @"--input")
{
Description = @"Model-agnostic video generation input. Fields are optional; the router selects a model and maps these options to it.",
Required = true,
};
private static Option<string?> RequestInput { get; } = new(@"--request-input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
};

private static Option<string?> RequestJson { get; } = new(@"--request-json")
{
Description = "Request body as JSON.",
Hidden = true,
};

private static Option<string?> RequestFile { get; } = new(@"--request-file")
{
Description = "Path to a JSON request file, or '-' for stdin.",
Hidden = true,
};

private static string FormatResponse(ParseResult parseResult, global::Runway.CreateGenerateVideoResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
Expand Down Expand Up @@ -74,44 +54,21 @@ public static Command Create()
Start a video generation task using a saved Model Router config instead of naming a model.");
command.Options.Add(XRunwayVersion);
command.Options.Add(ConfigId);
command.Options.Add(DryRun);
command.Options.Add(InputOption);
command.Options.Add(RequestInput);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
command.Validators.Add(result =>
{
var hasInput = result.GetResult(RequestInput) is not null;
var hasRequestJson = result.GetResult(RequestJson) is not null;
var hasRequestFile = result.GetResult(RequestFile) is not null;
var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0);
if (specifiedCount > 1)
{
result.AddError(@"Specify at most one of --request-input, --request-json, or --request-file.");
}
});


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync<global::Runway.CreateGenerateVideoRequest>(
parseResult,
RequestInput,
RequestJson,
RequestFile,
global::Runway.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var xRunwayVersion = parseResult.GetRequiredValue(XRunwayVersion);
var configId = parseResult.GetRequiredValue(ConfigId);
var dryRun = CliRuntime.WasSpecified(parseResult, DryRun) ? parseResult.GetValue(DryRun) : (__requestBase is { } __DryRunBaseValue ? __DryRunBaseValue.DryRun : default);
var input = parseResult.GetRequiredValue(InputOption);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.ModelRouter.CreateGenerateVideoAsync(
xRunwayVersion: xRunwayVersion,
configId: configId,
dryRun: dryRun,
input: input,
cancellationToken: cancellationToken).ConfigureAwait(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public partial interface IModelRouterClient
/// <param name="configId">
/// The slug of a saved Model Router config to route this request with.
/// </param>
/// <param name="dryRun">
/// When true, run the full routing pipeline and return the decision and estimated cost without generating. No task is created, nothing is billed, and no asset is produced.
/// </param>
/// <param name="input">
/// Model-agnostic audio generation input. The router selects a model and maps these options to it.
/// </param>
Expand All @@ -61,7 +58,6 @@ public partial interface IModelRouterClient
string configId,
global::Runway.CreateGenerateAudioRequestInput input,
string xRunwayVersion = "2024-11-06",
bool? dryRun = default,
global::Runway.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public partial interface IModelRouterClient
/// <param name="configId">
/// The slug of a saved Model Router config to route this request with.
/// </param>
/// <param name="dryRun">
/// When true, run the full routing pipeline and return the decision and estimated cost without generating. No task is created, nothing is billed, and no asset is produced.
/// </param>
/// <param name="input">
/// Model-agnostic image generation input. The router selects a model and maps these options to it.
/// </param>
Expand All @@ -61,7 +58,6 @@ public partial interface IModelRouterClient
string configId,
global::Runway.CreateGenerateImageRequestInput input,
string xRunwayVersion = "2024-11-06",
bool? dryRun = default,
global::Runway.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public partial interface IModelRouterClient
/// <param name="configId">
/// The slug of a saved Model Router config to route this request with.
/// </param>
/// <param name="dryRun">
/// When true, run the full routing pipeline and return the decision and estimated cost without generating. No task is created, nothing is billed, and no asset is produced.
/// </param>
/// <param name="input">
/// Model-agnostic video generation input. Fields are optional; the router selects a model and maps these options to it.
/// </param>
Expand All @@ -61,7 +58,6 @@ public partial interface IModelRouterClient
string configId,
global::Runway.CreateGenerateVideoRequestInput input,
string xRunwayVersion = "2024-11-06",
bool? dryRun = default,
global::Runway.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Loading
Loading