Skip to content

feat: Support voice_state/model_type for audio.voices.list #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 20, 2025
Merged

Conversation

chyroc
Copy link
Collaborator

@chyroc chyroc commented Jun 19, 2025

Summary by CodeRabbit

  • New Features
    • Added support for filtering voices by state when listing voices.
    • Introduced new voice states: "init", "cloned", and "all".
    • Voice entries now display their current state and model type when available.

@chyroc chyroc added the feature label Jun 19, 2025
Copy link

coderabbitai bot commented Jun 19, 2025

Walkthrough

A new VoiceState enum was introduced to represent different states of a voice. The Voice model now includes state and model_type attributes. The list methods in both VoicesClient and AsyncVoicesClient were updated to accept an optional voice_state parameter and arbitrary keyword arguments for filtering and additional request options. Public exports were updated accordingly.

Changes

File(s) Change Summary
cozepy/init.py Imported VoiceModelType and VoiceState from .audio.voices and added both to the __all__ export list.
cozepy/audio/voices/init.py Added VoiceState and VoiceModelType enums; extended Voice with model_type and state; updated list methods in VoicesClient and AsyncVoicesClient to accept voice_state and **kwargs.
tests/test_audio_voices.py Added mock_voice() helper function creating Voice instances with model_type and state; updated mocks to use it; imported new enums.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant VoicesClient
    participant API

    User->>VoicesClient: list(voice_state, **kwargs)
    VoicesClient->>API: GET /voices?voice_state=... + extra options
    API-->>VoicesClient: Response (filtered voices)
    VoicesClient-->>User: List of Voice objects (with state and model_type)
Loading

Poem

In the meadow of code, a new enum appears,
VoiceState now guides as the filtering clears.
Voices can whisper their state with delight,
Big or small, their models in sight.
With every new list, the queries grow bright—
A hop and a skip, the changes feel right! 🐇


📜 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 455d50e and 8afe9a8.

📒 Files selected for processing (3)
  • cozepy/__init__.py (2 hunks)
  • cozepy/audio/voices/__init__.py (5 hunks)
  • tests/test_audio_voices.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • cozepy/init.py
  • cozepy/audio/voices/init.py
🔇 Additional comments (4)
tests/test_audio_voices.py (4)

6-6: LGTM - Import additions support new Voice attributes.

The addition of VoiceModelType and VoiceState imports correctly supports the new attributes added to the Voice model.


11-25: Excellent refactoring - Centralizes mock Voice creation.

The new mock_voice() helper function is well-implemented:

  • Includes all necessary Voice attributes including the new model_type and state fields
  • Uses appropriate test values (VoiceModelType.BIG, VoiceState.INIT)
  • Properly typed with return annotation
  • Eliminates code duplication across test mocks

34-34: Good use of the new helper function.

The refactoring to use mock_voice().model_dump() reduces duplication and ensures consistency in mock data generation.


47-47: Consistent with the refactoring pattern.

The update to use the centralized mock_voice() helper maintains consistency across all mock functions.

✨ Finishing Touches
  • 📝 Generate Docstrings

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 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.

Copy link

codecov bot commented Jun 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.59%. Comparing base (d28c188) to head (698c37f).
Report is 1 commits behind head on main.

@@            Coverage Diff             @@
##             main     #269      +/-   ##
==========================================
+ Coverage   89.58%   89.59%   +0.01%     
==========================================
  Files          74       74              
  Lines        6959     6971      +12     
==========================================
+ Hits         6234     6246      +12     
  Misses        725      725              
Files with missing lines Coverage Δ
cozepy/__init__.py 100.00% <100.00%> (ø)
cozepy/audio/voices/__init__.py 100.00% <100.00%> (ø)
tests/test_audio_voices.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
cozepy/audio/voices/__init__.py (1)

11-15: Consider the semantic meaning of the ALL enum value

The VoiceState enum is well-defined, but the ALL value seems to represent a filter option rather than an actual voice state. Consider whether this belongs in the enum or should be handled differently in the filtering logic.

Alternatively, you could handle the "all states" case by passing None as the voice_state parameter, which would be more semantically accurate.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b9214b and ffa24dd.

📒 Files selected for processing (2)
  • cozepy/__init__.py (2 hunks)
  • cozepy/audio/voices/__init__.py (7 hunks)
🔇 Additional comments (6)
cozepy/__init__.py (2)

19-19: LGTM: Clean import addition

The import correctly adds VoiceState alongside the existing Voice import, maintaining consistency with the module's structure.


226-226: LGTM: Proper public API export

The addition of VoiceState to the __all__ list is correctly placed and follows the established pattern for audio voice-related exports.

cozepy/audio/voices/__init__.py (4)

1-1: LGTM: Proper enum import

The enum import is correctly added to support the new VoiceState enumeration.


48-50: LGTM: Backwards-compatible model extension

The optional state field addition is properly typed and maintains backwards compatibility with existing code.


146-153: LGTM: Proper parameter handling

The voice_state parameter is correctly included in the request params and properly handled with remove_none_values to avoid sending unnecessary parameters.


248-255: LGTM: Consistent parameter handling

The async method properly handles the voice_state parameter consistently with the sync version, using remove_none_values to filter out None values.

@chyroc chyroc changed the title feat: Support voice_state for audio.voices.list feat: Support voice_state/model_type for audio.voices.list Jun 20, 2025
@chyroc chyroc merged commit 4b03bc0 into main Jun 20, 2025
18 checks passed
@chyroc chyroc deleted the voice_state branch June 20, 2025 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant