Skip to content

Commit 316efef

Browse files
com.openai.unity 8.8.7 (#431)
- Fix VAD serialization not properly setting disabled values
1 parent 979ea8d commit 316efef

File tree

6 files changed

+20
-29
lines changed

6 files changed

+20
-29
lines changed

OpenAI/Packages/com.openai.unity/Runtime/Realtime/DisabledVAD.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public sealed class DisabledVAD : IVoiceActivityDetectionSettings
88
[Preserve]
99
public TurnDetectionType Type => TurnDetectionType.Disabled;
1010

11-
public bool CreateResponse => false;
11+
public bool? CreateResponse => null;
1212

13-
public bool InterruptResponse => false;
13+
public bool? InterruptResponse => null;
1414
}
1515
}

OpenAI/Packages/com.openai.unity/Runtime/Realtime/IVoiceActivityDetectionSettings.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace OpenAI.Realtime
66
public interface IVoiceActivityDetectionSettings
77
{
88
public TurnDetectionType Type { get; }
9-
public bool CreateResponse { get; }
10-
public bool InterruptResponse { get; }
9+
public bool? CreateResponse { get; }
10+
public bool? InterruptResponse { get; }
1111
}
12-
}
12+
}

OpenAI/Packages/com.openai.unity/Runtime/Realtime/SemanticVAD.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public SemanticVAD(bool createResponse = true, bool interruptResponse = true, VA
1616
[JsonConstructor]
1717
internal SemanticVAD(
1818
[JsonProperty("type")] TurnDetectionType type,
19-
[JsonProperty("create_response")] bool createResponse,
20-
[JsonProperty("interrupt_response")] bool interruptResponse,
19+
[JsonProperty("create_response")] bool? createResponse,
20+
[JsonProperty("interrupt_response")] bool? interruptResponse,
2121
[JsonProperty("eagerness")] VAD_Eagerness eagerness)
2222
{
2323
Type = type;
@@ -32,11 +32,11 @@ internal SemanticVAD(
3232

3333
[Preserve]
3434
[JsonProperty("create_response", DefaultValueHandling = DefaultValueHandling.Ignore)]
35-
public bool CreateResponse { get; private set; }
35+
public bool? CreateResponse { get; private set; }
3636

3737
[Preserve]
3838
[JsonProperty("interrupt_response", DefaultValueHandling = DefaultValueHandling.Ignore)]
39-
public bool InterruptResponse { get; private set; }
39+
public bool? InterruptResponse { get; private set; }
4040

4141
[Preserve]
4242
[JsonProperty("eagerness", DefaultValueHandling = DefaultValueHandling.Ignore)]

OpenAI/Packages/com.openai.unity/Runtime/Realtime/ServerVAD.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace OpenAI.Realtime
77
public sealed class ServerVAD : IVoiceActivityDetectionSettings
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)
@@ -23,8 +23,8 @@ public ServerVAD(
2323
[JsonConstructor]
2424
internal ServerVAD(
2525
[JsonProperty("type")] TurnDetectionType type,
26-
[JsonProperty("create_response")] bool createResponse,
27-
[JsonProperty("interrupt_response")] bool interruptResponse,
26+
[JsonProperty("create_response")] bool? createResponse,
27+
[JsonProperty("interrupt_response")] bool? interruptResponse,
2828
[JsonProperty("prefix_padding_ms")] int? prefixPadding,
2929
[JsonProperty("silence_duration_ms")] int? silenceDuration,
3030
[JsonProperty("threshold")] float? detectionThreshold)
@@ -43,11 +43,11 @@ internal ServerVAD(
4343

4444
[Preserve]
4545
[JsonProperty("create_response", DefaultValueHandling = DefaultValueHandling.Ignore)]
46-
public bool CreateResponse { get; private set; }
46+
public bool? CreateResponse { get; private set; }
4747

4848
[Preserve]
4949
[JsonProperty("interrupt_response", DefaultValueHandling = DefaultValueHandling.Ignore)]
50-
public bool InterruptResponse { get; private set; }
50+
public bool? InterruptResponse { get; private set; }
5151

5252
[Preserve]
5353
[JsonProperty("prefix_padding_ms", DefaultValueHandling = DefaultValueHandling.Ignore)]

OpenAI/Packages/com.openai.unity/Runtime/Realtime/VoiceActivityDetectionSettings.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,12 @@ namespace OpenAI.Realtime
1010
[Obsolete("Use new IVoiceActivityDetectionSettings classes: SemanticVAD, ServerVAD, and DisabledVAD")]
1111
public sealed class VoiceActivityDetectionSettings : IVoiceActivityDetectionSettings
1212
{
13-
private VoiceActivityDetectionSettings(TurnDetectionType type)
14-
{
15-
Type = type;
16-
DetectionThreshold = null;
17-
PrefixPadding = null;
18-
SilenceDuration = null;
19-
CreateResponse = false;
20-
}
21-
2213
public VoiceActivityDetectionSettings(
2314
[JsonProperty("type")] TurnDetectionType type = TurnDetectionType.Server_VAD,
2415
[JsonProperty("threshold")] float? detectionThreshold = null,
2516
[JsonProperty("prefix_padding_ms")] int? prefixPadding = null,
2617
[JsonProperty("silence_duration_ms")] int? silenceDuration = null,
27-
[JsonProperty("create_response")] bool createResponse = true)
18+
[JsonProperty("create_response")] bool? createResponse = true)
2819
{
2920
switch (type)
3021
{
@@ -41,7 +32,7 @@ public VoiceActivityDetectionSettings(
4132
DetectionThreshold = null;
4233
PrefixPadding = null;
4334
SilenceDuration = null;
44-
CreateResponse = false;
35+
CreateResponse = null;
4536
break;
4637
}
4738
}
@@ -52,10 +43,10 @@ public VoiceActivityDetectionSettings(
5243

5344
[Preserve]
5445
[JsonProperty("create_response", DefaultValueHandling = DefaultValueHandling.Ignore)]
55-
public bool CreateResponse { get; private set; }
46+
public bool? CreateResponse { get; private set; }
5647

5748
[JsonProperty("interrupt_response", DefaultValueHandling = DefaultValueHandling.Ignore)]
58-
public bool InterruptResponse { get; private set; }
49+
public bool? InterruptResponse { get; private set; }
5950

6051
[Preserve]
6152
[JsonProperty("prefix_padding_ms", DefaultValueHandling = DefaultValueHandling.Ignore)]

OpenAI/Packages/com.openai.unity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "OpenAI",
44
"description": "A OpenAI package for the Unity to use though their RESTful API.\n\nIndependently developed, this is not an official library and I am not affiliated with OpenAI.\n\nAn OpenAI API account is required.",
55
"keywords": [],
6-
"version": "8.8.6",
6+
"version": "8.8.7",
77
"unity": "2021.3",
88
"documentationUrl": "https://github.com/RageAgainstThePixel/com.openai.unity#documentation",
99
"changelogUrl": "https://github.com/RageAgainstThePixel/com.openai.unity/releases",

0 commit comments

Comments
 (0)