Skip to content

Commit

Permalink
ctrs
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Feb 9, 2025
1 parent 65e0cd2 commit 00dda40
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions OpenAI-DotNet/Realtime/CreateResponseRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public CreateResponseRequest() { }
[Obsolete("Use the constructor that takes RealtimeResponseCreateParams.")]
public CreateResponseRequest(Options options)
{
Options = options;
}

/// <summary>
Expand Down
13 changes: 12 additions & 1 deletion OpenAI-DotNet/Realtime/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace OpenAI.Realtime
{
[Obsolete("use SessionConfiguration")]
[Obsolete("use SessionConfiguration or RealtimeResponseCreateParams")]
public sealed class Options
{
public static implicit operator SessionConfiguration(Options options)
Expand All @@ -26,6 +26,17 @@ public static implicit operator SessionConfiguration(Options options)
options.Temperature,
options.MaxResponseOutputTokens);

public static implicit operator RealtimeResponseCreateParams(Options options)
=> new(
options.Modalities,
options.Instructions,
options.Voice,
options.OutputAudioFormat,
options.Tools,
options.ToolChoice,
options.Temperature,
options.MaxResponseOutputTokens);

public Options() { }

public Options(
Expand Down
20 changes: 20 additions & 0 deletions OpenAI-DotNet/Realtime/RealtimeResponseCreateParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,26 @@ public RealtimeResponseCreateParams(
}
}

internal RealtimeResponseCreateParams(
Modality modalities,
string instructions,
string voice,
RealtimeAudioFormat outputAudioFormat,
IReadOnlyList<Function> tools,
object toolChoice,
float? temperature,
object maxResponseOutputTokens)
{
Modalities = modalities;
Instructions = instructions;
Voice = voice;
OutputAudioFormat = outputAudioFormat;
Tools = tools?.ToList();
ToolChoice = toolChoice;
Temperature = temperature;
MaxResponseOutputTokens = maxResponseOutputTokens;
}

/// <summary>
/// The set of modalities the model can respond with. To disable audio, set this to ["text"].
/// </summary>
Expand Down

0 comments on commit 00dda40

Please sign in to comment.