Skip to content

fixes agent examples#563

Merged
jpvajda merged 1 commit into
mainfrom
chore/agent-example-fix
Aug 6, 2025
Merged

fixes agent examples#563
jpvajda merged 1 commit into
mainfrom
chore/agent-example-fix

Conversation

@jpvajda

@jpvajda jpvajda commented Aug 2, 2025

Copy link
Copy Markdown
Contributor

PR Summary: Fix Missing Speak Provider Configuration in Agent Examples

Problem:
Two of the three agent examples (simple and async_simple) were missing the required speak provider configuration, which could cause issues with text-to-speech functionality.

Solution:
Added missing speak provider configuration to both examples:

options.agent.speak.provider.type = "deepgram"
options.agent.speak.provider.model = "aura-2-thalia-en"

Files Changed:

  • examples/agent/simple/main.py - Added speak provider config
  • examples/agent/async_simple/main.py - Added speak provider config

Testing:
✅ All three agent examples now work correctly:

  • examples/agent/simple/main.py
  • examples/agent/async_simple/main.py
  • examples/agent/no_mic/main.py (already had correct config)

Impact:
Ensures consistent configuration across all agent examples and prevents potential TTS-related issues for users following the example code.
Ran tool

Types of changes

What types of changes does your code introduce to the community Python 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 configuration to enable the agent to use Deepgram's speech synthesis with the "aura-2-thalia-en" model.
  • Chores

    • Adjusted logging verbosity level for improved clarity in logs.

@jpvajda
jpvajda requested a review from naomi-lgbt August 2, 2025 16:58
@coderabbitai

coderabbitai Bot commented Aug 2, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update agent example scripts to explicitly configure the speech synthesis provider to use Deepgram with the "aura-2-thalia-en" model. Additionally, the logging verbosity for Deepgram client options is reduced from SPAM to INFO in one example. No changes were made to public APIs or exported entities.

Changes

Cohort / File(s) Change Summary
Agent Example: Async Simple
examples/agent/async_simple/main.py
Adds explicit configuration for the agent's speech synthesis provider: sets type to "deepgram" and model to "aura-2-thalia-en".
Agent Example: Simple
examples/agent/simple/main.py
Sets speaking provider type/model as above; also lowers Deepgram client logging verbosity from SPAM to INFO.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Agent
    participant Deepgram

    User->>Agent: Start session
    Agent->>Deepgram: Configure speech synthesis (type: deepgram, model: aura-2-thalia-en)
    Agent->>Deepgram: Send text for synthesis
    Deepgram-->>Agent: Return synthesized speech
    Agent-->>User: Play synthesized speech
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • naomi-lgbt

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Pylint (3.3.7)
examples/agent/async_simple/main.py
examples/agent/simple/main.py

📜 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 4fc8756 and 626fc7c.

📒 Files selected for processing (2)
  • examples/agent/async_simple/main.py (1 hunks)
  • examples/agent/simple/main.py (2 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#468
File: examples/text-to-speech/websocket/complete/main.py:26-30
Timestamp: 2024-09-27T15:21:34.197Z
Learning: In `examples/text-to-speech/websocket/complete/main.py`, commented-out options like `auto_flush_speak_delta` and `verbose` are intentional in examples and should not be flagged in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: examples/speak-stream/async-interactive/main.py:4-4
Timestamp: 2024-06-27T00:07:31.967Z
Learning: The examples folder in the `deepgram-python-sdk` repository is disabled in the configuration, and issues within files in this directory should not be flagged.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#417
File: deepgram/clients/live/v1/client.py:14-14
Timestamp: 2024-06-12T18:02:10.651Z
Learning: Ignore suggestions to change import paths to local versions in test cases and examples as per user preference to use the actual `deepgram-sdk` package for testing.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#417
File: deepgram/clients/live/v1/client.py:14-14
Timestamp: 2024-10-09T02:19:48.728Z
Learning: Ignore suggestions to change import paths to local versions in test cases and examples as per user preference to use the actual `deepgram-sdk` package for testing.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/clients/speak/v1/response.py:48-209
Timestamp: 2024-06-27T00:06:23.128Z
Learning: User dvonthenen prefers to defer certain suggestions, specifically regarding error handling and documentation enhancements in new data classes of `deepgram/clients/speak/v1/response.py`, and may revisit them later.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/clients/speak/v1/response.py:48-209
Timestamp: 2024-10-09T02:19:48.728Z
Learning: User dvonthenen prefers to defer certain suggestions, specifically regarding error handling and documentation enhancements in new data classes of `deepgram/clients/speak/v1/response.py`, and may revisit them later.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#472
File: examples/speech-to-text/websocket/replay/main.py:78-80
Timestamp: 2024-10-18T16:20:17.742Z
Learning: In the `examples` directory of the Deepgram Python SDK, code is intended as illustrative examples and doesn't require production-level error handling.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: examples/speak-stream/interactive/main.py:8-8
Timestamp: 2024-06-27T00:02:56.197Z
Learning: In the `deepgram-python-sdk` project, unused imports in example files are intentionally retained for educational or demonstrative purposes and should not be flagged as issues.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: examples/speak-stream/interactive/main.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: In the `deepgram-python-sdk` project, unused imports in example files are intentionally retained for educational or demonstrative purposes and should not be flagged as issues.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/client.py:81-81
Timestamp: 2024-06-27T00:06:01.811Z
Learning: Imports for SpeakStreamClient and AsyncSpeakStreamClient in `deepgram/client.py` are necessary for export purposes and should not be flagged as unused in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/speak/__init__.py:16-19
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in `deepgram/clients/speak/__init__.py` are retained for backward compatibility and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/speak/__init__.py:16-19
Timestamp: 2024-07-01T19:12:57.715Z
Learning: Unused imports in `deepgram/clients/speak/__init__.py` are retained for backward compatibility and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/client.py:81-81
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Imports for SpeakStreamClient and AsyncSpeakStreamClient in `deepgram/client.py` are necessary for export purposes and should not be flagged as unused in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/__init__.py:36-43
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/__init__.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.
📚 Learning: in `examples/text-to-speech/websocket/complete/main.py`, commented-out options like `auto_flush_spea...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#468
File: examples/text-to-speech/websocket/complete/main.py:26-30
Timestamp: 2024-09-27T15:21:34.197Z
Learning: In `examples/text-to-speech/websocket/complete/main.py`, commented-out options like `auto_flush_speak_delta` and `verbose` are intentional in examples and should not be flagged in reviews.

Applied to files:

  • examples/agent/async_simple/main.py
  • examples/agent/simple/main.py
📚 Learning: imports for speakstreamclient and asyncspeakstreamclient in `deepgram/client.py` are necessary for e...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/client.py:81-81
Timestamp: 2024-06-27T00:06:01.811Z
Learning: Imports for SpeakStreamClient and AsyncSpeakStreamClient in `deepgram/client.py` are necessary for export purposes and should not be flagged as unused in reviews.

Applied to files:

  • examples/agent/async_simple/main.py
📚 Learning: unused imports in `deepgram/clients/speak/__init__.py` are retained for backward compatibility and s...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/speak/__init__.py:16-19
Timestamp: 2024-07-01T19:12:57.715Z
Learning: Unused imports in `deepgram/clients/speak/__init__.py` are retained for backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • examples/agent/async_simple/main.py
  • examples/agent/simple/main.py
📚 Learning: imports for deepgramclientoptions and clientoptionsfromenv in deepgram/clients/listen/__init__.py sh...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:6-6
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Imports for DeepgramClientOptions and ClientOptionsFromEnv in deepgram/clients/listen/__init__.py should not be flagged as unused in reviews.

Applied to files:

  • examples/agent/async_simple/main.py
  • examples/agent/simple/main.py
📚 Learning: unused imports in `deepgram/clients/listen/v1/rest/options.py` are retained to maintain backwards co...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/rest/options.py:12-12
Timestamp: 2024-07-01T19:12:36.972Z
Learning: Unused imports in `deepgram/clients/listen/v1/rest/options.py` are retained to maintain backwards compatibility.

Applied to files:

  • examples/agent/async_simple/main.py
  • examples/agent/simple/main.py
📚 Learning: in `examples/text-to-speech/websocket/output_to_wav/main.py`, the hardcoded values for `audio_file` ...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#472
File: examples/text-to-speech/websocket/output_to_wav/main.py:16-17
Timestamp: 2024-10-18T00:30:20.224Z
Learning: In `examples/text-to-speech/websocket/output_to_wav/main.py`, the hardcoded values for `AUDIO_FILE` and `TTS_TEXT` are intentional and should remain as is.

Applied to files:

  • examples/agent/async_simple/main.py
📚 Learning: unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compati...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/__init__.py:36-43
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • examples/agent/simple/main.py
📚 Learning: unused imports in `deepgram/clients/listen/v1/websocket/__init__.py` are retained to maintain backwa...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/websocket/__init__.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/v1/websocket/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • examples/agent/simple/main.py
📚 Learning: when initializing `deepgramclient` without providing an api key, it uses the `deepgram_api_key` envi...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#472
File: examples/speech-to-text/websocket/replay/main.py:23-27
Timestamp: 2024-10-18T16:19:48.637Z
Learning: When initializing `DeepgramClient` without providing an API key, it uses the `DEEPGRAM_API_KEY` environment variable internally.

Applied to files:

  • examples/agent/simple/main.py
📚 Learning: in the deepgram python sdk, deepgramclient("arbitrary-string") should be treated as an api key for b...
Learnt from: lukeocodes
PR: deepgram/deepgram-python-sdk#543
File: tests/unit_test/test_unit_authentication.py:67-87
Timestamp: 2025-06-22T17:02:32.416Z
Learning: In the Deepgram Python SDK, DeepgramClient("arbitrary-string") should be treated as an API key for backward compatibility with existing code patterns.

Applied to files:

  • examples/agent/simple/main.py
📚 Learning: unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibil...
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:37-38
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibility.

Applied to files:

  • examples/agent/simple/main.py
🧬 Code Graph Analysis (2)
examples/agent/async_simple/main.py (1)
deepgram/client.py (2)
  • agent (593-597)
  • speak (505-509)
examples/agent/simple/main.py (2)
deepgram/utils/verboselogs/__init__.py (1)
  • verbose (165-168)
deepgram/client.py (2)
  • agent (593-597)
  • speak (505-509)
🔇 Additional comments (3)
examples/agent/async_simple/main.py (1)

117-118: Excellent bug fix for TTS functionality!

The addition of the speak provider configuration resolves the missing TTS setup that was causing issues. The "deepgram" provider type with "aura-2-thalia-en" model is a proper configuration that enables speech synthesis functionality.

examples/agent/simple/main.py (2)

45-45: Good logging level adjustment.

Changing from SPAM to INFO reduces verbosity to a more appropriate level for example code, making the output cleaner for users following along.


141-142: Perfect consistency with async example.

The speak provider configuration matches exactly with examples/agent/async_simple/main.py lines 117-118, ensuring consistent TTS functionality across both synchronous and asynchronous agent examples.

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

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 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
jpvajda requested a review from lukeocodes August 2, 2025 16:58
"speaker_playback": "true",
},
verbose=verboselogs.SPAM,
verbose=verboselogs.INFO,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reduced to info as the logs were crazy big

@jpvajda
jpvajda merged commit fa60252 into main Aug 6, 2025
3 checks passed
@jpvajda
jpvajda deleted the chore/agent-example-fix branch August 6, 2025 14:45
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.

2 participants