diff --git a/Deepgram/Clients/Agent/v2/Websocket/Client.cs b/Deepgram/Clients/Agent/v2/Websocket/Client.cs index 39b3ac2a..1ee16057 100644 --- a/Deepgram/Clients/Agent/v2/Websocket/Client.cs +++ b/Deepgram/Clients/Agent/v2/Websocket/Client.cs @@ -7,6 +7,7 @@ using Deepgram.Models.Agent.v2.WebSocket; using Common = Deepgram.Models.Common.v2.WebSocket; using Deepgram.Clients.Interfaces.v2; +using Deepgram.Models.Exceptions.v1; namespace Deepgram.Clients.Agent.v2.WebSocket; @@ -51,6 +52,10 @@ public Client(string? apiKey = null, IDeepgramClientOptions? options = null) : b public async Task Connect(SettingsConfigurationSchema options, CancellationTokenSource? cancelToken = null, Dictionary? addons = null, Dictionary? headers = null) { + if (!options.Agent.Listen.Model.StartsWith("nova-3") && options.Agent.Listen.Keyterms?.Count > 0) + { + throw new DeepgramException("Keyterms is only supported in Nova 3 models."); + } Log.Verbose("AgentWSClient.Connect", "ENTER"); Log.Information("Connect", $"options:\n{JsonSerializer.Serialize(options, JsonSerializeOptions.DefaultOptions)}"); Log.Debug("Connect", $"addons: {addons}"); diff --git a/Deepgram/Clients/Listen/v2/WebSocket/Client.cs b/Deepgram/Clients/Listen/v2/WebSocket/Client.cs index ad93626b..e06a31e1 100644 --- a/Deepgram/Clients/Listen/v2/WebSocket/Client.cs +++ b/Deepgram/Clients/Listen/v2/WebSocket/Client.cs @@ -8,6 +8,7 @@ using Deepgram.Models.Listen.v2.WebSocket; using Common = Deepgram.Models.Common.v2.WebSocket; using Deepgram.Clients.Interfaces.v2; +using Deepgram.Models.Exceptions.v1; namespace Deepgram.Clients.Listen.v2.WebSocket; @@ -49,6 +50,10 @@ public Client(string? apiKey = null, IDeepgramClientOptions? options = null) : b public async Task Connect(LiveSchema options, CancellationTokenSource? cancelToken = null, Dictionary? addons = null, Dictionary? headers = null) { + if (!options.Model.StartsWith("nova-3") && options.Keyterms?.Count > 0) + { + throw new DeepgramException("Keyterms is only supported in Nova 3 models."); + } Log.Verbose("ListenWSClient.Connect", "ENTER"); Log.Information("Connect", $"options:\n{JsonSerializer.Serialize(options, JsonSerializeOptions.DefaultOptions)}"); Log.Debug("Connect", $"addons: {addons}");