Skip to content

Added support for noise cancellation model for daily#715

Open
kanakagrawal-crypto wants to merge 1 commit into
juspay:releasefrom
kanakagrawal-crypto:noise_cancel
Open

Added support for noise cancellation model for daily#715
kanakagrawal-crypto wants to merge 1 commit into
juspay:releasefrom
kanakagrawal-crypto:noise_cancel

Conversation

@kanakagrawal-crypto
Copy link
Copy Markdown

@kanakagrawal-crypto kanakagrawal-crypto commented Apr 17, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Optimized audio processing for different call transport types. Daily calls now use a specialized audio model, while telephony transport types use standard audio processing, improving audio quality and compatibility across communication channels.

Copilot AI review requested due to automatic review settings April 17, 2026 11:21
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f9ddf7cd-2530-4ccd-954b-9419b562e8b2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This pull request adds transport-type-aware AIC model path selection to the Breeze Buddy agent. A new function selects the 16kHz model for daily transport and defaults otherwise. The audio input filter factory now accepts transport type and creates separate filter instances per transport variant, with appropriate model paths wired into the respective transport parameter factories.

Changes

Cohort / File(s) Summary
Transport-Specific Audio Filter Configuration
app/ai/voice/agents/breeze_buddy/agent/transport.py
Added _get_aic_model_path() to select model files by transport type (16kHz for daily, default otherwise). Updated _create_audio_input_filter() with transport_type parameter and model path selection logic. Modified get_transport_params() to create separate input filters per transport type (daily vs. twilio-based variants).
AIC Model Path Configuration
app/core/config/static.py
Added AIC_MODEL_PATH_16KHZ configuration constant sourced from environment variable with default filesystem path to 16kHz .aicmodel file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Hops through transports, swift and spry,
Daily's sixteen, the rest stand by,
Models chosen, paths aligned,
Filter magic, transport-defined! 🎧✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding support for a 16kHz noise cancellation model specifically for the 'daily' transport type.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
app/ai/voice/agents/breeze_buddy/agent/transport.py (2)

112-116: Avoid instantiating the unused AIC filter.

Each call to get_transport_params() now eagerly constructs both a daily and a telephony AICFilter, but only one lambda in the returned dict is ever invoked per call (the transport is selected by the caller via transport_params[transport_type]()). Loading the unused .aicmodel and holding the extra license-bound resource is wasted work on every setup path.

Consider deferring filter creation into the per-transport lambdas so only the selected transport pays the cost:

♻️ Proposed refactor
-    # Create filters per transport type for proper model selection
-    audio_in_filter_daily = _create_audio_input_filter(
-        configurations, TRANSPORT_TYPE_DAILY
-    )
-    audio_in_filter_telephony = _create_audio_input_filter(configurations, "twilio")
-
     return {
         "daily": lambda: DailyParams(
             audio_in_enabled=True,
             audio_out_enabled=True,
-            audio_in_filter=audio_in_filter_daily,
+            audio_in_filter=_create_audio_input_filter(
+                configurations, TRANSPORT_TYPE_DAILY
+            ),
             # Note: DailyParams does not support audio_out_mixer
         ),
         "twilio": lambda: FastAPIWebsocketParams(
             ...
-            audio_in_filter=audio_in_filter_telephony,
+            audio_in_filter=_create_audio_input_filter(configurations, "twilio"),
         ),
         ...
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/ai/voice/agents/breeze_buddy/agent/transport.py` around lines 112 - 116,
get_transport_params currently eagerly constructs both audio_in_filter_daily and
audio_in_filter_telephony by calling _create_audio_input_filter(...) even though
the returned dict only invokes one lambda; move the
_create_audio_input_filter(...) calls into the respective per-transport lambdas
(the values in the dict returned by get_transport_params) so each AICFilter is
created lazily when transport_params[transport_type]() is executed (use
TRANSPORT_TYPE_DAILY for the daily branch and "twilio" for the telephony branch)
to avoid loading the unused .aicmodel and consuming the license-bound resource.

116-116: Extract a telephony transport constant.

The string "twilio" is used here as a stand-in for "any non-daily / telephony transport" to drive 8kHz model selection in _get_aic_model_path. This is fragile — if someone renames TRANSPORT_TYPE_DAILY semantics or adds a new telephony transport that happens to match "daily", the selection silently breaks. Consider a dedicated constant (e.g. TRANSPORT_TYPE_TELEPHONY = "telephony") and branch _get_aic_model_path explicitly on daily vs telephony intent rather than on concrete transport names.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/ai/voice/agents/breeze_buddy/agent/transport.py` at line 116, Replace the
hard-coded "twilio" transport string with a dedicated telephony constant and
update model-selection logic: add a constant like TRANSPORT_TYPE_TELEPHONY =
"telephony", change the call that sets audio_in_filter_telephony (currently
using _create_audio_input_filter(..., "twilio")) to use that constant, and
modify _get_aic_model_path to branch explicitly on TRANSPORT_TYPE_DAILY vs
TRANSPORT_TYPE_TELEPHONY (instead of matching concrete transport names) so 8kHz
model selection is driven by transport intent rather than a specific provider
name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/ai/voice/agents/breeze_buddy/agent/transport.py`:
- Around line 112-116: get_transport_params currently eagerly constructs both
audio_in_filter_daily and audio_in_filter_telephony by calling
_create_audio_input_filter(...) even though the returned dict only invokes one
lambda; move the _create_audio_input_filter(...) calls into the respective
per-transport lambdas (the values in the dict returned by get_transport_params)
so each AICFilter is created lazily when transport_params[transport_type]() is
executed (use TRANSPORT_TYPE_DAILY for the daily branch and "twilio" for the
telephony branch) to avoid loading the unused .aicmodel and consuming the
license-bound resource.
- Line 116: Replace the hard-coded "twilio" transport string with a dedicated
telephony constant and update model-selection logic: add a constant like
TRANSPORT_TYPE_TELEPHONY = "telephony", change the call that sets
audio_in_filter_telephony (currently using _create_audio_input_filter(...,
"twilio")) to use that constant, and modify _get_aic_model_path to branch
explicitly on TRANSPORT_TYPE_DAILY vs TRANSPORT_TYPE_TELEPHONY (instead of
matching concrete transport names) so 8kHz model selection is driven by
transport intent rather than a specific provider name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a1d6d70-ac3f-47e7-98e7-5e7097e76e6d

📥 Commits

Reviewing files that changed from the base of the PR and between 2f1864f and 59aed40.

📒 Files selected for processing (2)
  • app/ai/voice/agents/breeze_buddy/agent/transport.py
  • app/core/config/static.py

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds transport-aware selection of the ai-coustics (AIC) noise cancellation model so Breeze Buddy can use a 16kHz model for Daily (web) audio and keep using an 8kHz model for telephony transports.

Changes:

  • Introduces a new AIC_MODEL_PATH_16KHZ static config entry with a default 16kHz model path.
  • Adds _get_aic_model_path() and threads transport_type into Breeze Buddy AIC filter creation to select 8kHz vs 16kHz models.
  • Updates transport parameter construction to use different input filters for Daily vs telephony transports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/core/config/static.py Adds a new env-configurable 16kHz AIC model path.
app/ai/voice/agents/breeze_buddy/agent/transport.py Selects AIC model by transport and wires per-transport audio input filters.

Comment thread app/ai/voice/agents/breeze_buddy/agent/transport.py Outdated
Comment thread app/ai/voice/agents/breeze_buddy/agent/transport.py Outdated
Comment thread app/ai/voice/agents/breeze_buddy/agent/transport.py
Comment thread app/ai/voice/agents/breeze_buddy/agent/transport.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants