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 @@ -51,6 +51,12 @@ internal static partial class RealtimeSessionsCreateRealtimeSessionsCommandApiCo
{
Description = @"Tools available to the avatar during the session.",
};

private static Option<global::Runway.Integration?> Integration { get; } = new(
name: @"--integration")
{
Description = @"External integration. Runway renders the avatar; the integration owns conversation or audio.",
};
private static Option<string?> Input { get; } = new(@"--input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
Expand Down Expand Up @@ -99,6 +105,7 @@ public static Command Create()
command.Options.Add(Personality);
command.Options.Add(StartScript);
command.Options.Add(Tools);
command.Options.Add(Integration);
command.Options.Add(Input);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
Expand Down Expand Up @@ -131,6 +138,7 @@ await CliRuntime.RunAsync(async () =>
var personality = CliRuntime.WasSpecified(parseResult, Personality) ? parseResult.GetValue(Personality) : (__requestBase is { } __PersonalityBaseValue ? __PersonalityBaseValue.Personality : default);
var startScript = CliRuntime.WasSpecified(parseResult, StartScript) ? parseResult.GetValue(StartScript) : (__requestBase is { } __StartScriptBaseValue ? __StartScriptBaseValue.StartScript : default);
var tools = CliRuntime.WasSpecified(parseResult, Tools) ? parseResult.GetValue(Tools) : (__requestBase is { } __ToolsBaseValue ? __ToolsBaseValue.Tools : default);
var integration = CliRuntime.WasSpecified(parseResult, Integration) ? parseResult.GetValue(Integration) : (__requestBase is { } __IntegrationBaseValue ? __IntegrationBaseValue.Integration : default);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


Expand All @@ -142,6 +150,7 @@ await CliRuntime.RunAsync(async () =>
personality: personality,
startScript: startScript,
tools: tools,
integration: integration,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#nullable enable

#pragma warning disable CS0618 // Type or member is obsolete

namespace Runway
{
public partial interface IRealtimeSessionsClient
Expand Down Expand Up @@ -93,6 +95,9 @@ public partial interface IRealtimeSessionsClient
/// Tools available to the avatar during the session.<br/>
/// Default Value: []
/// </param>
/// <param name="integration">
/// External integration. Runway renders the avatar; the integration owns conversation or audio.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
Expand All @@ -104,6 +109,7 @@ public partial interface IRealtimeSessionsClient
string? personality = default,
string? startScript = default,
global::System.Collections.Generic.IList<global::Runway.ToolsItem>? tools = default,
global::Runway.Integration? integration = default,
global::Runway.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Runway.JsonConverters
{
/// <inheritdoc />
public sealed class CreateRealtimeSessionsRequestIntegrationDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType>
{
/// <inheritdoc />
public override global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorTypeExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace Runway.JsonConverters
{
/// <inheritdoc />
public sealed class CreateRealtimeSessionsRequestIntegrationDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType?>
{
/// <inheritdoc />
public override global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorTypeExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorType? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::Runway.CreateRealtimeSessionsRequestIntegrationDiscriminatorTypeExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public class CreateSoundEffectRequestJsonConverter : global::System.Text.Json.Se
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Runway.CreateSoundEffectRequestDiscriminator)}");
var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo);

global::Runway.CreateSoundEffectRequestSeedAudio? seedAudio = default;
if (discriminator?.Model == global::Runway.CreateSoundEffectRequestDiscriminatorModel.SeedAudio)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.CreateSoundEffectRequestSeedAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.CreateSoundEffectRequestSeedAudio> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Runway.CreateSoundEffectRequestSeedAudio)}");
seedAudio = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
global::Runway.CreateSoundEffectRequestElevenTextToSoundV2? elevenTextToSoundV2 = default;
if (discriminator?.Model == global::Runway.CreateSoundEffectRequestDiscriminatorModel.ElevenTextToSoundV2)
{
Expand All @@ -31,6 +38,8 @@ public class CreateSoundEffectRequestJsonConverter : global::System.Text.Json.Se

var __value = new global::Runway.CreateSoundEffectRequest(
discriminator?.Model,
seedAudio,

elevenTextToSoundV2
);

Expand All @@ -46,7 +55,13 @@ public override void Write(
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsElevenTextToSoundV2)
if (value.IsSeedAudio)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.CreateSoundEffectRequestSeedAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.CreateSoundEffectRequestSeedAudio?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.CreateSoundEffectRequestSeedAudio).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.SeedAudio!, typeInfo);
}
else if (value.IsElevenTextToSoundV2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.CreateSoundEffectRequestElevenTextToSoundV2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.CreateSoundEffectRequestElevenTextToSoundV2?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.CreateSoundEffectRequestElevenTextToSoundV2).Name}");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Runway.JsonConverters
{
/// <inheritdoc />
public sealed class CreateSoundEffectRequestSeedAudioOutputFormatJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat>
{
/// <inheritdoc />
public override global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Runway.CreateSoundEffectRequestSeedAudioOutputFormatExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Runway.CreateSoundEffectRequestSeedAudioOutputFormatExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace Runway.JsonConverters
{
/// <inheritdoc />
public sealed class CreateSoundEffectRequestSeedAudioOutputFormatNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat?>
{
/// <inheritdoc />
public override global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Runway.CreateSoundEffectRequestSeedAudioOutputFormatExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Runway.CreateSoundEffectRequestSeedAudioOutputFormat? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::Runway.CreateSoundEffectRequestSeedAudioOutputFormatExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public class CreateTextToSpeechRequestJsonConverter : global::System.Text.Json.S
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Runway.CreateTextToSpeechRequestDiscriminator)}");
var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo);

global::Runway.CreateTextToSpeechRequestSeedAudio? seedAudio = default;
if (discriminator?.Model == global::Runway.CreateTextToSpeechRequestDiscriminatorModel.SeedAudio)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.CreateTextToSpeechRequestSeedAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.CreateTextToSpeechRequestSeedAudio> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Runway.CreateTextToSpeechRequestSeedAudio)}");
seedAudio = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
global::Runway.CreateTextToSpeechRequestElevenMultilingualV2? elevenMultilingualV2 = default;
if (discriminator?.Model == global::Runway.CreateTextToSpeechRequestDiscriminatorModel.ElevenMultilingualV2)
{
Expand All @@ -31,6 +38,8 @@ public class CreateTextToSpeechRequestJsonConverter : global::System.Text.Json.S

var __value = new global::Runway.CreateTextToSpeechRequest(
discriminator?.Model,
seedAudio,

elevenMultilingualV2
);

Expand All @@ -46,7 +55,13 @@ public override void Write(
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsElevenMultilingualV2)
if (value.IsSeedAudio)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.CreateTextToSpeechRequestSeedAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.CreateTextToSpeechRequestSeedAudio?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.CreateTextToSpeechRequestSeedAudio).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.SeedAudio!, typeInfo);
}
else if (value.IsElevenMultilingualV2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.CreateTextToSpeechRequestElevenMultilingualV2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.CreateTextToSpeechRequestElevenMultilingualV2?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.CreateTextToSpeechRequestElevenMultilingualV2).Name}");
Expand Down
Loading
Loading