-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Deprecated OpenAI.Realtime.Options - Added OpenAI.Realtime.SessionConfiguration to specify the options of the RealtimeSession when creating a new session - Added OpenAI.Realtime.RealtimeResponseCreateParams to specify the options of the CreateResponseRequest - Added VoiceActivityDetectionSettingsConverter to better handle disabled voice activity detection - Added VoiceActivityDetectionSettings.CreateResponse property
- Loading branch information
1 parent
94f671d
commit 9607121
Showing
21 changed files
with
891 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
OpenAI-DotNet/Extensions/VoiceActivityDetectionSettingsConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using OpenAI.Realtime; | ||
using System; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace OpenAI | ||
{ | ||
internal class VoiceActivityDetectionSettingsConverter : JsonConverter<VoiceActivityDetectionSettings> | ||
{ | ||
public override VoiceActivityDetectionSettings Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
return reader.TokenType == JsonTokenType.Null | ||
? VoiceActivityDetectionSettings.Disabled() | ||
: JsonSerializer.Deserialize<VoiceActivityDetectionSettings>(ref reader, options); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, VoiceActivityDetectionSettings value, JsonSerializerOptions options) | ||
{ | ||
switch (value.Type) | ||
{ | ||
case TurnDetectionType.Disabled: | ||
writer.WriteNullValue(); | ||
break; | ||
default: | ||
case TurnDetectionType.Server_VAD: | ||
JsonSerializer.Serialize(writer, value, options); | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System.Runtime.Serialization; | ||
|
||
namespace OpenAI.Realtime | ||
{ | ||
public enum ConversationResponseType | ||
{ | ||
[EnumMember(Value = "auto")] | ||
Auto = 0, | ||
[EnumMember(Value = "none")] | ||
None = 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.