Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/CustomClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ListenV1Client.ConnectArgs, "Authorization"> & { Authorization?: string }): Promise<ListenV1Socket> {
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<string, unknown>).model as string | undefined;
const keywords = (args as Record<string, unknown>).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",
Expand Down