Skip to content

Conversation

@Nash0x7E2
Copy link
Member

@Nash0x7E2 Nash0x7E2 commented Nov 14, 2025

Summary by CodeRabbit

  • New Features

    • Restricted TTS model selection to supported versions: "inworld-tts-1" and "inworld-tts-1-max" (default).
  • Bug Fixes

    • Improved HTTP error handling in TTS operations with explicit error detection and logging.

@Nash0x7E2 Nash0x7E2 self-assigned this Nov 14, 2025
@cursor
Copy link

cursor bot commented Nov 14, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 7.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2025

Walkthrough

Simplified Agent instruction text in the example file by removing a prefix phrase. Enhanced the TTS module with restricted model ID type validation using Literal constraints and added HTTP error handling to the response processing and streaming paths.

Changes

Cohort / File(s) Summary
Inworld TTS Example
plugins/inworld/example/inworld_tts_example.py
Simplified Agent constructor instruction parameter from "You're a helpful voice AI assistant.Read @inworld-audio-guide.md" to "Read @inworld-audio-guide.md".
Inworld TTS Module Enhancement
plugins/inworld/vision_agents/plugins/inworld/tts.py
Introduced Literal["inworld-tts-1", "inworld-tts-1-max"] type constraint for model_id parameter (default: "inworld-tts-1"); added Literal to typing imports. Implemented HTTP error handling in _process_response to raise on HTTP status ≥ 400 and in stream_audio for HTTPStatusError exceptions during streaming.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant TTS
    participant ResponseHandler
    participant HTTPClient

    Caller->>TTS: stream_audio(model_id, ...)
    
    rect rgb(220, 240, 255)
    note over TTS,HTTPClient: New error handling path
    TTS->>HTTPClient: send request
    HTTPClient-->>TTS: response (HTTP 400+)
    TTS->>ResponseHandler: _process_response()
    ResponseHandler->>ResponseHandler: check status >= 400
    ResponseHandler->>ResponseHandler: raise HTTPStatusError
    TTS->>TTS: catch HTTPStatusError
    TTS->>TTS: log error
    TTS-->>Caller: re-raise exception
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • TTS type restriction: Verify Literal constraints align with backend API capabilities and that default value is appropriate
  • Error handling paths: Ensure HTTP error propagation doesn't suppress warnings or create unintended side effects in streaming scenarios
  • Example file simplification: Confirm instruction changes don't alter agent behavior in expected use cases

Possibly related PRs

  • Add Inworld TTS plugin #179: Earlier PR modifying the same example file; this change refines the Agent instruction text introduced previously.

Suggested labels

plugins

Poem

The model constrained to two names only,
Literal walls rise around the streaming flow—
Each error caught and logged, a ceremony,
Where status codes no longer hide below.
Instruction trimmed to essence, clean and holy.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix: HTTP error parsing for Inworld' directly addresses the main change: adding HTTP error handling in the TTS streaming path.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/inworld-http

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

@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: 0

🧹 Nitpick comments (1)
plugins/inworld/vision_agents/plugins/inworld/tts.py (1)

107-120: Consider consolidating duplicate error logging.

The HTTP error handling correctly validates status codes and raises exceptions. However, when HTTPStatusError is raised here (lines 116-120) after logging (lines 111-115), it's caught and logged again at lines 92-98, creating duplicate log entries for the same error.

Consider either:

  • Removing the logging from lines 111-115 and letting the outer catch block handle it, or
  • Raising a simpler exception here without the outer catch duplicating the log
     async def _process_response(self, response: httpx.Response) -> AsyncIterator[PcmData]:
-        # Check status before processing streaming response
         if response.status_code >= 400:
             error_text = await response.aread()
             error_msg = error_text.decode() if error_text else "Unknown error"
-            logger.error(
-                "Inworld AI API HTTP error: %s - %s",
-                response.status_code,
-                error_msg,
-            )
             raise httpx.HTTPStatusError(
                 f"HTTP {response.status_code}: {error_msg}",
                 request=response.request,
                 response=response,
             )
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9aec603 and a796410.

📒 Files selected for processing (2)
  • plugins/inworld/example/inworld_tts_example.py (1 hunks)
  • plugins/inworld/vision_agents/plugins/inworld/tts.py (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-13T21:25:18.060Z
Learnt from: Nash0x7E2
Repo: GetStream/Vision-Agents PR: 179
File: plugins/inworld/vision_agents/plugins/inworld/tts.py:73-76
Timestamp: 2025-11-13T21:25:18.060Z
Learning: For Inworld AI TTS API authentication in plugins/inworld/vision_agents/plugins/inworld/tts.py, the Authorization header format `f"Basic {self.api_key}"` is correct. The API key obtained from Inworld's Dashboard is already in the proper format and does not require manual Base64 encoding of key:secret.

Applied to files:

  • plugins/inworld/example/inworld_tts_example.py
  • plugins/inworld/vision_agents/plugins/inworld/tts.py
🧬 Code graph analysis (1)
plugins/inworld/vision_agents/plugins/inworld/tts.py (1)
plugins/inworld/tests/test_tts.py (1)
  • tts (14-15)
⏰ 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). (4)
  • GitHub Check: unit / Ruff & mypy
  • GitHub Check: unit / Test "not integration"
  • GitHub Check: unit / Ruff & mypy
  • GitHub Check: unit / Test "not integration"
🔇 Additional comments (4)
plugins/inworld/vision_agents/plugins/inworld/tts.py (3)

6-6: LGTM: Import addition supports type safety.

The Literal import is necessary for the model_id type constraint and improves type safety.


12-13: LGTM: Formatting improvements.

The import reorganization and formatting adjustments improve code readability without affecting functionality.

Also applies to: 59-59, 88-88, 175-175


25-30: Model ID constraint is correct.

The valid Inworld AI TTS model IDs are inworld-tts-1 and inworld-tts-1-max, which matches the Literal type constraint in the code. The type safety improvement is verified and properly implemented.

plugins/inworld/example/inworld_tts_example.py (1)

38-38: LGTM: Simplified instruction text.

The streamlined instruction removes redundant preamble and focuses on the core directive. The change also resolves the spacing issue in the original text.

@Nash0x7E2 Nash0x7E2 merged commit e423dd1 into main Nov 14, 2025
6 checks passed
@Nash0x7E2 Nash0x7E2 deleted the chore/inworld-http branch November 14, 2025 04:55
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.

2 participants