diff --git a/src/CustomClient.ts b/src/CustomClient.ts index 94e0b829..1bd58863 100644 --- a/src/CustomClient.ts +++ b/src/CustomClient.ts @@ -629,10 +629,24 @@ class WrappedAgentV1Socket extends AgentV1Socket { * consistent behavior across Fern regenerations and allows us to customize * connection setup, authentication, and header handling. */ +const NOVA3_MODELS = ["nova-3", "nova-3-general", "nova-3-medical"] as const; + class WrappedListenV1Client extends ListenV1Client { public async connect(args: Omit & { Authorization?: string }): Promise { const { headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args; + // Warn when 'keywords' is used with nova-3 — the API rejects this combination. + // 'keywords' is not supported on nova-3; use 'keyterm' instead. + const model = (args as Record).model as string | undefined; + const keywords = (args as Record).keywords; + if (keywords != null && model != null && NOVA3_MODELS.some((m) => model === m || model.startsWith(m))) { + console.warn( + "[Deepgram] The 'keywords' parameter is not supported with nova-3 models and will cause " + + "the WebSocket connection to be rejected (HTTP 400). Use 'keyterm' instead. " + + "See: https://developers.deepgram.com/docs/keyterm" + ); + } + const socket = await createWebSocketConnection({ options: this._options, urlPath: "/v1/listen",