diff --git a/OpenAI-DotNet/OpenAI-DotNet.csproj b/OpenAI-DotNet/OpenAI-DotNet.csproj index 1b5e1624..83f76e14 100644 --- a/OpenAI-DotNet/OpenAI-DotNet.csproj +++ b/OpenAI-DotNet/OpenAI-DotNet.csproj @@ -29,8 +29,10 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet- OpenAI-DotNet.pfx true true - 8.8.6 + 8.8.7 +Version 8.8.7 +- Fix VAD serialization not properly setting disabled values Version 8.8.6 - Fix Realtime.UpdateSessionRequests failing to update session due to extra client secret data Version 8.8.4 diff --git a/OpenAI-DotNet/Realtime/DisabledVAD.cs b/OpenAI-DotNet/Realtime/DisabledVAD.cs index 506c6687..993bf52c 100644 --- a/OpenAI-DotNet/Realtime/DisabledVAD.cs +++ b/OpenAI-DotNet/Realtime/DisabledVAD.cs @@ -4,8 +4,8 @@ public sealed class DisabledVAD : IVoiceActivityDetectionSettings { public TurnDetectionType Type => TurnDetectionType.Disabled; - public bool CreateResponse => false; + public bool? CreateResponse => null; - public bool InterruptResponse => false; + public bool? InterruptResponse => null; } } diff --git a/OpenAI-DotNet/Realtime/IVoiceActivityDetectionSettings.cs b/OpenAI-DotNet/Realtime/IVoiceActivityDetectionSettings.cs index 072a5e00..9e8dd717 100644 --- a/OpenAI-DotNet/Realtime/IVoiceActivityDetectionSettings.cs +++ b/OpenAI-DotNet/Realtime/IVoiceActivityDetectionSettings.cs @@ -3,7 +3,7 @@ public interface IVoiceActivityDetectionSettings { public TurnDetectionType Type { get; } - public bool CreateResponse { get; } - public bool InterruptResponse { get; } + public bool? CreateResponse { get; } + public bool? InterruptResponse { get; } } } diff --git a/OpenAI-DotNet/Realtime/SemanticVAD.cs b/OpenAI-DotNet/Realtime/SemanticVAD.cs index a8e3bfc2..10c51146 100644 --- a/OpenAI-DotNet/Realtime/SemanticVAD.cs +++ b/OpenAI-DotNet/Realtime/SemanticVAD.cs @@ -6,7 +6,10 @@ public sealed class SemanticVAD : IVoiceActivityDetectionSettings { public SemanticVAD() { } - public SemanticVAD(bool createResponse = true, bool interruptResponse = true, VAD_Eagerness eagerness = VAD_Eagerness.Auto) + public SemanticVAD( + bool? createResponse = true, + bool? interruptResponse = true, + VAD_Eagerness eagerness = VAD_Eagerness.Auto) { CreateResponse = createResponse; InterruptResponse = interruptResponse; @@ -20,11 +23,13 @@ public SemanticVAD(bool createResponse = true, bool interruptResponse = true, VA [JsonInclude] [JsonPropertyName("create_response")] - public bool CreateResponse { get; private set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? CreateResponse { get; private set; } [JsonInclude] [JsonPropertyName("interrupt_response")] - public bool InterruptResponse { get; private set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? InterruptResponse { get; private set; } [JsonInclude] [JsonPropertyName("eagerness")] diff --git a/OpenAI-DotNet/Realtime/ServerVAD.cs b/OpenAI-DotNet/Realtime/ServerVAD.cs index 8a922c96..781743a1 100644 --- a/OpenAI-DotNet/Realtime/ServerVAD.cs +++ b/OpenAI-DotNet/Realtime/ServerVAD.cs @@ -7,8 +7,8 @@ public sealed class ServerVAD : IVoiceActivityDetectionSettings public ServerVAD() { } public ServerVAD( - bool createResponse = true, - bool interruptResponse = true, + bool? createResponse = true, + bool? interruptResponse = true, int? prefixPadding = null, int? silenceDuration = null, float? detectionThreshold = null) @@ -27,11 +27,13 @@ public ServerVAD( [JsonInclude] [JsonPropertyName("create_response")] - public bool CreateResponse { get; private set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? CreateResponse { get; private set; } [JsonInclude] [JsonPropertyName("interrupt_response")] - public bool InterruptResponse { get; private set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? InterruptResponse { get; private set; } [JsonInclude] [JsonPropertyName("prefix_padding_ms")] diff --git a/OpenAI-DotNet/Realtime/VoiceActivityDetectionSettings.cs b/OpenAI-DotNet/Realtime/VoiceActivityDetectionSettings.cs index 1906e49d..71123265 100644 --- a/OpenAI-DotNet/Realtime/VoiceActivityDetectionSettings.cs +++ b/OpenAI-DotNet/Realtime/VoiceActivityDetectionSettings.cs @@ -15,7 +15,7 @@ public VoiceActivityDetectionSettings( float? detectionThreshold = null, int? prefixPadding = null, int? silenceDuration = null, - bool createResponse = true) + bool? createResponse = true) { switch (type) { @@ -32,7 +32,7 @@ public VoiceActivityDetectionSettings( DetectionThreshold = null; PrefixPadding = null; SilenceDuration = null; - CreateResponse = false; + CreateResponse = null; break; } } @@ -45,13 +45,13 @@ public VoiceActivityDetectionSettings( [JsonInclude] [JsonPropertyName("create_response")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public bool CreateResponse { get; private set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? CreateResponse { get; private set; } [JsonInclude] [JsonPropertyName("interrupt_response")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public bool InterruptResponse { get; private set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? InterruptResponse { get; private set; } [JsonInclude] [JsonPropertyName("threshold")]