Skip to content

Commit efe07a5

Browse files
OpenAI-DotNet 8.8.7 (#506)
- Fix VAD serialization not properly setting disabled values
1 parent f54ebab commit efe07a5

File tree

6 files changed

+27
-18
lines changed

6 files changed

+27
-18
lines changed

OpenAI-DotNet/OpenAI-DotNet.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet-
2929
<AssemblyOriginatorKeyFile>OpenAI-DotNet.pfx</AssemblyOriginatorKeyFile>
3030
<IncludeSymbols>true</IncludeSymbols>
3131
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
32-
<Version>8.8.6</Version>
32+
<Version>8.8.7</Version>
3333
<PackageReleaseNotes>
34+
Version 8.8.7
35+
- Fix VAD serialization not properly setting disabled values
3436
Version 8.8.6
3537
- Fix Realtime.UpdateSessionRequests failing to update session due to extra client secret data
3638
Version 8.8.4

OpenAI-DotNet/Realtime/DisabledVAD.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ public sealed class DisabledVAD : IVoiceActivityDetectionSettings
44
{
55
public TurnDetectionType Type => TurnDetectionType.Disabled;
66

7-
public bool CreateResponse => false;
7+
public bool? CreateResponse => null;
88

9-
public bool InterruptResponse => false;
9+
public bool? InterruptResponse => null;
1010
}
1111
}

OpenAI-DotNet/Realtime/IVoiceActivityDetectionSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public interface IVoiceActivityDetectionSettings
44
{
55
public TurnDetectionType Type { get; }
6-
public bool CreateResponse { get; }
7-
public bool InterruptResponse { get; }
6+
public bool? CreateResponse { get; }
7+
public bool? InterruptResponse { get; }
88
}
99
}

OpenAI-DotNet/Realtime/SemanticVAD.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ public sealed class SemanticVAD : IVoiceActivityDetectionSettings
66
{
77
public SemanticVAD() { }
88

9-
public SemanticVAD(bool createResponse = true, bool interruptResponse = true, VAD_Eagerness eagerness = VAD_Eagerness.Auto)
9+
public SemanticVAD(
10+
bool? createResponse = true,
11+
bool? interruptResponse = true,
12+
VAD_Eagerness eagerness = VAD_Eagerness.Auto)
1013
{
1114
CreateResponse = createResponse;
1215
InterruptResponse = interruptResponse;
@@ -20,11 +23,13 @@ public SemanticVAD(bool createResponse = true, bool interruptResponse = true, VA
2023

2124
[JsonInclude]
2225
[JsonPropertyName("create_response")]
23-
public bool CreateResponse { get; private set; }
26+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
27+
public bool? CreateResponse { get; private set; }
2428

2529
[JsonInclude]
2630
[JsonPropertyName("interrupt_response")]
27-
public bool InterruptResponse { get; private set; }
31+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
32+
public bool? InterruptResponse { get; private set; }
2833

2934
[JsonInclude]
3035
[JsonPropertyName("eagerness")]

OpenAI-DotNet/Realtime/ServerVAD.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ public sealed class ServerVAD : IVoiceActivityDetectionSettings
77
public ServerVAD() { }
88

99
public ServerVAD(
10-
bool createResponse = true,
11-
bool interruptResponse = true,
10+
bool? createResponse = true,
11+
bool? interruptResponse = true,
1212
int? prefixPadding = null,
1313
int? silenceDuration = null,
1414
float? detectionThreshold = null)
@@ -27,11 +27,13 @@ public ServerVAD(
2727

2828
[JsonInclude]
2929
[JsonPropertyName("create_response")]
30-
public bool CreateResponse { get; private set; }
30+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
31+
public bool? CreateResponse { get; private set; }
3132

3233
[JsonInclude]
3334
[JsonPropertyName("interrupt_response")]
34-
public bool InterruptResponse { get; private set; }
35+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
36+
public bool? InterruptResponse { get; private set; }
3537

3638
[JsonInclude]
3739
[JsonPropertyName("prefix_padding_ms")]

OpenAI-DotNet/Realtime/VoiceActivityDetectionSettings.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public VoiceActivityDetectionSettings(
1515
float? detectionThreshold = null,
1616
int? prefixPadding = null,
1717
int? silenceDuration = null,
18-
bool createResponse = true)
18+
bool? createResponse = true)
1919
{
2020
switch (type)
2121
{
@@ -32,7 +32,7 @@ public VoiceActivityDetectionSettings(
3232
DetectionThreshold = null;
3333
PrefixPadding = null;
3434
SilenceDuration = null;
35-
CreateResponse = false;
35+
CreateResponse = null;
3636
break;
3737
}
3838
}
@@ -45,13 +45,13 @@ public VoiceActivityDetectionSettings(
4545

4646
[JsonInclude]
4747
[JsonPropertyName("create_response")]
48-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
49-
public bool CreateResponse { get; private set; }
48+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
49+
public bool? CreateResponse { get; private set; }
5050

5151
[JsonInclude]
5252
[JsonPropertyName("interrupt_response")]
53-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
54-
public bool InterruptResponse { get; private set; }
53+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
54+
public bool? InterruptResponse { get; private set; }
5555

5656
[JsonInclude]
5757
[JsonPropertyName("threshold")]

0 commit comments

Comments
 (0)