Update Streamlit, error handling, and prepare for a new release#187
Update Streamlit, error handling, and prepare for a new release#187barun-saha merged 5 commits intomainfrom
Conversation
WalkthroughUpdates package version to 8.0.5, refines error handling for authentication-specific errors in progress streaming, changes logging levels from logger.exception to logger.error to reduce verbosity, updates documentation references and provider descriptions, and bumps dependency versions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app.py (1)
480-489: Consider a more robust exception detection approach.The current implementation uses string matching to detect
litellm.AuthenticationError(line 481). While this works, it's fragile and could fail if the exception is wrapped or the string representation changes.Consider one of these more robust approaches:
- Import
litellm.AuthenticationErrordirectly and useisinstance()checking- Have the helper modules raise a custom exception (e.g.,
AuthenticationError) that wraps the litellm exceptionThat said, the current implementation is still an improvement as it provides clearer, authentication-specific error messages to users and includes a generic fallback for unexpected errors.
Example of approach 1 (if litellm is available):
+try: + import litellm +except ImportError: + litellm = None + ... except Exception as ex: - if 'litellm.AuthenticationError' in str(ex): + if litellm and isinstance(ex, litellm.AuthenticationError): handle_error(Example of approach 2 (custom exception in helper module):
In
src/slidedeckai/helpers/llm_helper.py, define a custom exception:class AuthenticationError(Exception): """Raised when LLM authentication fails.""" passThen wrap and re-raise in the exception handler, and catch it specifically in app.py.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
README.md(1 hunks)app.py(1 hunks)requirements.txt(1 hunks)src/slidedeckai/_version.py(1 hunks)src/slidedeckai/core.py(1 hunks)src/slidedeckai/global_config.py(1 hunks)src/slidedeckai/helpers/llm_helper.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.py: Use single quotes for strings in Python code unless double quotes are necessary; use triple double quotes for docstrings
Include type hints for parameters and return types when defining functions
Use f-strings for string formatting instead of % or .format() (except for logs)
Use Google-style docstrings for all functions and classes
Use two blank lines before top-level function and class definitions; use one blank line between methods inside a class
Enforce maximum line length of 100 characters; use brackets to break long lines and wrap long strings or expressions inside parentheses
Split long lines at braces with each parameter on a new line, indented inside parentheses
Files:
src/slidedeckai/core.pysrc/slidedeckai/helpers/llm_helper.pyapp.pysrc/slidedeckai/global_config.pysrc/slidedeckai/_version.py
🪛 Ruff (0.14.7)
src/slidedeckai/core.py
263-263: Use logging.exception instead of logging.error
Replace with exception
(TRY400)
src/slidedeckai/helpers/llm_helper.py
219-219: Use logging.exception instead of logging.error
Replace with exception
(TRY400)
⏰ 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). (3)
- GitHub Check: test (3.11)
- GitHub Check: test (3.12)
- GitHub Check: test (3.10)
🔇 Additional comments (5)
src/slidedeckai/helpers/llm_helper.py (1)
218-220: LGTM: Logging change aligns with PR objectives.The change from
logger.exceptiontologger.errorreduces log verbosity as intended per issue #179. Since the exception is re-raised immediately after logging, the caller still has access to the full exception context for proper handling.Note: The static analysis hint (Ruff TRY400) suggesting
logging.exceptioncan be ignored as this is an intentional change per the PR objectives.Based on PR objectives, this change is part of the effort to reduce verbosity of error logs.
src/slidedeckai/_version.py (1)
1-1: LGTM: Version bump for new release.The version has been correctly bumped to 8.0.5, consistent with the PR objectives for preparing a new release.
README.md (1)
7-7: LGTM: SDK version aligned with requirements.The sdk_version has been updated to 1.52.1, properly aligning with the Streamlit version specified in requirements.txt. This brings the documentation in sync with the actual dependency version.
src/slidedeckai/core.py (1)
262-264: LGTM: Logging change consistent with PR objectives.The change from
logger.exceptiontologger.erroris consistent with the PR-wide effort to reduce log verbosity as per issue #179. The error is still logged with meaningful context.Note: The static analysis hint (Ruff TRY400) can be ignored as this is an intentional change.
Based on PR objectives, this change reduces verbosity of error logs.
src/slidedeckai/global_config.py (1)
229-231: LGTM: Improved maintainability and accurate documentation link.The changes improve maintainability:
- Using "several providers" instead of "eight different providers" avoids hardcoding a count that may change.
- The updated URL fragment
#unmatched-flexibility-choose-your-ai-braincorrectly points to the corresponding section in README.md (line 84).
Closes #179.
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.