Skip to content

feat: adds support for agent mip_opt_out#421

Merged
jpvajda merged 1 commit into
mainfrom
feat/agent-mip_opt_out
Jul 21, 2025
Merged

feat: adds support for agent mip_opt_out#421
jpvajda merged 1 commit into
mainfrom
feat/agent-mip_opt_out

Conversation

@jpvajda

@jpvajda jpvajda commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

PR Summary: Add mip_opt_out Agent Settings Support

🚀 TL;DR

Added mip_opt_out: boolean field to Agent configuration schema, allowing users to opt out of Deepgram Model Improvement Program. Fully tested with 3 new unit tests, all 229 tests passing, no breaking changes.


📋 What Changed

Files Modified:

  1. src/lib/types/AgentLiveSchema.ts - Added mip_opt_out?: boolean field to agent configuration
  2. tests/unit/live-client-message-handling.test.ts - Added 3 comprehensive unit tests

New Feature:

  • Users can now add mip_opt_out: true to their agent configuration to opt out of the Deepgram Model Improvement Program
  • Field is optional (defaults to false per API spec)
  • Fully type-safe with proper TypeScript definitions

🎯 Why This Change

Per API specification requirements, agents need the ability to opt out of the Deepgram Model Improvement Program. This change implements the missing mip_opt_out setting in the JavaScript SDK to match the API capabilities.

🔧 Implementation Details

Schema Addition:

// Added to AgentLiveSchema interface
/**
 * To opt out of Deepgram Model Improvement Program.
 * @default false
 */
mip_opt_out?: boolean;

Usage Example:

agent.configure({
  agent: {
    listen: { model: "nova-3" },
    speak: { model: "aura-asteria-en" },
    mip_opt_out: true  // New field
  }
});

Testing

New Unit Tests Added:

  1. should accept mip_opt_out as true - Validates mip_opt_out: true configuration
  2. should accept mip_opt_out as false - Validates mip_opt_out: false configuration
  3. should work without mip_opt_out (default behavior) - Validates optional field behavior

Test Results:

  • 229/229 tests passing (3 new tests added)
  • 53/53 test suites passing
  • No regressions introduced
  • All existing functionality preserved

🔍 Validation Performed

  1. Schema Acceptance - Verified TypeScript compilation accepts new field
  2. Configure Method - Confirmed agent.configure() properly handles new field
  3. JSON Serialization - Validated proper JSON structure with new field
  4. Backward Compatibility - Ensured existing code continues to work

Types of changes

What types of changes does your code introduce to the community JavaScript SDK?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update or tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have lint'ed all of my code using repo standards
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • New Features

    • Added support for a new optional setting to opt out of the Deepgram Model Improvement Program.
  • Tests

    • Introduced tests to verify correct handling of the new opt-out setting in various configurations.

@jpvajda jpvajda requested a review from lukeocodes July 18, 2025 21:34
@coderabbitai

coderabbitai Bot commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A new optional boolean property, mip_opt_out, was added to the agent object in the AgentLiveSchema interface to indicate opt-out status for the Deepgram Model Improvement Program. Corresponding unit tests were introduced to verify correct handling of this property in client configuration scenarios.

Changes

File(s) Change Summary
src/lib/types/AgentLiveSchema.ts Added optional mip_opt_out?: boolean property (default false) to agent in AgentLiveSchema.
tests/unit/live-client-message-handling.test.ts Added tests for handling of the mip_opt_out property in agent configuration during client setup.

Sequence Diagram(s)

sequenceDiagram
    participant TestSuite as Test Suite
    participant Client as AgentLiveClient
    participant MockConn as Mock Connection

    TestSuite->>Client: configure({ agent: { mip_opt_out: true/false/omitted } })
    Client->>MockConn: send(JSON.stringify({ settings: { agent: { mip_opt_out: ... } } }))
    MockConn-->>Client: ack
    Client-->>TestSuite: configuration processed
Loading

Suggested reviewers

  • naomi-lgbt

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b94ea56 and 7c302f2.

📒 Files selected for processing (2)
  • src/lib/types/AgentLiveSchema.ts (1 hunks)
  • tests/unit/live-client-message-handling.test.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test Browser Builds
🔇 Additional comments (2)
src/lib/types/AgentLiveSchema.ts (1)

83-87: LGTM! Well-implemented optional property with proper documentation.

The mip_opt_out property is correctly implemented with:

  • Proper TypeScript optional typing (?: boolean)
  • Clear JSDoc documentation explaining its purpose
  • Documented default value of false
  • Appropriate placement within the agent configuration object

This implementation aligns perfectly with the PR objectives to add Model Improvement Program opt-out support.

tests/unit/live-client-message-handling.test.ts (1)

578-631: Excellent test coverage for the new mip_opt_out feature.

The test suite comprehensively covers all scenarios for the new optional property:

  • mip_opt_out: true - verifies explicit opt-out
  • mip_opt_out: false - verifies explicit opt-in
  • ✅ Omitted property - verifies default behavior

Each test follows the established pattern of configuring the client and asserting the correct message is sent via WebSocket. The test structure is consistent with existing tests in the file and provides confidence that the feature works as intended.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/agent-mip_opt_out

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.13%. Comparing base (b94ea56) to head (7c302f2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #421   +/-   ##
=======================================
  Coverage   75.13%   75.13%           
=======================================
  Files          26       26           
  Lines        1150     1150           
  Branches      291      291           
=======================================
  Hits          864      864           
  Misses        286      286           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jpvajda jpvajda merged commit 76f9653 into main Jul 21, 2025
7 checks passed
@jpvajda jpvajda deleted the feat/agent-mip_opt_out branch July 21, 2025 15:35
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.

3 participants