Skip to content

Conversation

@jpvajda
Copy link
Contributor

@jpvajda jpvajda commented Jun 27, 2025

Proposed changes

Types of changes

  • 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)

Further comments


Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation

    • Updated reference links in comments to point to the latest Deepgram voice agent configuration and TTS models documentation.
  • New Features

    • Enhanced support for the speak provider configuration, allowing both a single provider object and an array of provider objects.
  • Tests

    • Added new tests to verify correct handling of single and multiple speak provider configurations and the updateSpeak method.

@jpvajda jpvajda requested review from lukeocodes and naomi-lgbt June 27, 2025 21:16
@jpvajda jpvajda changed the title feat: adds support for speak fallback provider [WIP] feat: adds support for speak fallback provider Jun 27, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 27, 2025

"""

Walkthrough

The AgentLiveSchema interface was updated to allow the speak property to accept either a single provider object or an array of provider objects. Documentation URLs in comments were updated. Corresponding unit tests were added to verify correct handling of both single and multiple speak providers in configuration and update messages.

Changes

File(s) Change Summary
src/lib/types/AgentLiveSchema.ts Updated speak property to accept a single object or an array; added SpeakProvider type; updated documentation URLs in comments.
tests/unit/live-client-message-handling.test.ts Added unit tests for handling single and multiple speak provider configurations and update messages; reorganized existing tests.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server

    Note over Client: Configuration with speak provider(s)
    Client->>Server: Send "Settings" message (single or array of speak providers)

    Note over Client: Updating speak provider(s)
    Client->>Server: Send "UpdateSpeak" message (single or array of speak providers)
Loading

Possibly related PRs

  • deepgram/deepgram-js-sdk#396: Refines the speak property by introducing a generic Provider type, affecting the speak property type in AgentLiveSchema.ts.
  • deepgram/deepgram-js-sdk#379: Updates AgentLiveSchema type, allowing the speak property to be a single object or an array, with related schema-level changes.

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 7c0c784 and 95ee10f.

📒 Files selected for processing (2)
  • src/lib/types/AgentLiveSchema.ts (3 hunks)
  • tests/unit/live-client-message-handling.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/unit/live-client-message-handling.test.ts
  • src/lib/types/AgentLiveSchema.ts
⏰ 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). (2)
  • GitHub Check: Test / OS ubuntu-latest / Node 18
  • GitHub Check: Analyze (javascript-typescript)
✨ 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-fallbacks

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.

@jpvajda
Copy link
Contributor Author

jpvajda commented Jun 27, 2025

Will release with #413

@jpvajda
Copy link
Contributor Author

jpvajda commented Jun 27, 2025

CI Test is failing due to unrelated code not changed in this PR:

/home/runner/work/deepgram-js-sdk/deepgram-js-sdk/examples/node-agent-live/index.js
Error:   2:1  error  Definition for rule '@typescript-eslint/no-var-requires' was not found     @typescript-eslint/no-var-requires
Error:   2:1  error  Definition for rule '@typescript-eslint/no-require-imports' was not found  @typescript-eslint/no-require-imports

/home/runner/work/deepgram-js-sdk/deepgram-js-sdk/examples/node-live-token/index.js
Error:   2:1  error  Definition for rule '@typescript-eslint/no-var-requires' was not found     @typescript-eslint/no-var-requires
Error:   2:1  error  Definition for rule '@typescript-eslint/no-require-imports' was not found  @typescript-eslint/no-require-imports

/home/runner/work/deepgram-js-sdk/deepgram-js-sdk/examples/node-live/index.js
Error:   2:1  error  Definition for rule '@typescript-eslint/no-var-requires' was not found     @typescript-eslint/no-var-requires
Error:   2:1  error  Definition for rule '@typescript-eslint/no-require-imports' was not found  @typescript-eslint/no-require-imports

/home/runner/work/deepgram-js-sdk/deepgram-js-sdk/examples/node-prerecorded/index.js
Error:   2:1  error  Definition for rule '@typescript-eslint/no-var-requires' was not found     @typescript-eslint/no-var-requires
Error:   2:1  error  Definition for rule '@typescript-eslint/no-require-imports' was not found  @typescript-eslint/no-require-imports

/home/runner/work/deepgram-js-sdk/deepgram-js-sdk/examples/node-read/index.js
Error:   2:1  error  Definition for rule '@typescript-eslint/no-var-requires' was not found     @typescript-eslint/no-var-requires
Error:   2:1  error  Definition for rule '@typescript-eslint/no-require-imports' was not found  @typescript-eslint/no-require-imports

/home/runner/work/deepgram-js-sdk/deepgram-js-sdk/examples/node-speak-live/index.js
Error:   2:1  error  Definition for rule '@typescript-eslint/no-var-requires' was not found     @typescript-eslint/no-var-requires
Error:   2:1  error  Definition for rule '@typescript-eslint/no-require-imports' was not found  @typescript-eslint/no-require-imports

/home/runner/work/deepgram-js-sdk/deepgram-js-sdk/examples/node-speak/index.js
Error:   2:1  error  Definition for rule '@typescript-eslint/no-var-requires' was not found     @typescript-eslint/no-var-requires
Error:   2:1  error  Definition for rule '@typescript-eslint/no-require-imports' was not found  @typescript-eslint/no-require-imports

@jpvajda jpvajda changed the title [WIP] feat: adds support for speak fallback provider feat: adds support for speak fallback provider Jul 2, 2025
@jpvajda jpvajda changed the title feat: adds support for speak fallback provider feat: adds support for speak fallback Jul 3, 2025
@jpvajda jpvajda requested a review from lukeocodes July 3, 2025 20:03
@jpvajda
Copy link
Contributor Author

jpvajda commented Jul 3, 2025

I did a simple local test application to further test these changes. Results are ✅

Test Results Summary:

  1. Mock WebSocket connected - to wss://agent.deepgram.com/v1/agent/converse
  2. All 6 tests passed - each sent proper JSON messages
  3. 6 total messages sent - confirming all configurations worked

SpeakProvider Verification:

Single SpeakProvider (Deepgram):

{"type":"Settings","agent":{"speak":{"provider":{"type":"deepgram","model":"aura-2-zeus-en"}}}}

Single SpeakProvider (OpenAI with endpoint):

{"type":"Settings","agent":{"speak":{"provider":{"type":"openai","model":"tts-1","voice":"shimmer"},"endpoint":{"url":"https://api.openai.com/v1/audio/speech","headers":{"Authorization":"Bearer sk-test-key"}}}}}

Array of SpeakProviders:

{"type":"Settings","agent":{"speak":[{"provider":{"type":"deepgram","model":"aura-2-zeus-en"}},{"provider":{"type":"openai","model":"tts-1","voice":"alloy"},"endpoint":{"url":"https://api.openai.com/v1/audio/speech","headers":{"Authorization":"Bearer sk-test-key"}}}]}}

Code Review Success:

Your speak?: SpeakProvider | SpeakProvider[] refactoring is working perfectly! The type system correctly handles:

  • ✅ Single provider configurations
  • ✅ Array of provider configurations
  • ✅ Provider-specific properties (model, voice, etc.)
  • ✅ Optional endpoint configurations
  • ✅ Runtime updates via updateSpeak()

Future Steps: The refactoring is complete and verified! You can now safely remove the test file and commit your changes. The code review requirement has been fully satisfied while maintaining the generic Provider design pattern.

lukeocodes
lukeocodes previously approved these changes Jul 7, 2025
Copy link
Contributor

@lukeocodes lukeocodes left a comment

Choose a reason for hiding this comment

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

much better

@jpvajda
Copy link
Contributor Author

jpvajda commented Jul 8, 2025

This branch has conflicts now due to merging in #414 I can fix in the AM. @jpvajda 🧇

@jpvajda jpvajda force-pushed the feat/agent-fallbacks branch from 7c0c784 to 95ee10f Compare July 8, 2025 15:26
@jpvajda jpvajda merged commit 8e59b55 into main Jul 8, 2025
6 checks passed
@jpvajda jpvajda deleted the feat/agent-fallbacks branch July 8, 2025 16:08
@coderabbitai coderabbitai bot mentioned this pull request Aug 6, 2025
8 tasks
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