-
Notifications
You must be signed in to change notification settings - Fork 114
Fix: HTTP error parsing for Inworld #182
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
Conversation
|
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. |
WalkthroughSimplified 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
HTTPStatusErroris 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.
📒 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.pyplugins/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
Literalimport 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-1andinworld-tts-1-max, which matches theLiteraltype 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.
Summary by CodeRabbit
New Features
Bug Fixes