Skip to content

Update Streamlit, error handling, and prepare for a new release#187

Merged
barun-saha merged 5 commits intomainfrom
visual
Dec 6, 2025
Merged

Update Streamlit, error handling, and prepare for a new release#187
barun-saha merged 5 commits intomainfrom
visual

Conversation

@barun-saha
Copy link
Owner

@barun-saha barun-saha commented Dec 6, 2025

Closes #179.

Summary by CodeRabbit

  • New Features

    • Improved error handling with clearer authentication failure messages during processing.
    • Updated documentation to better reflect AI provider flexibility.
  • Chores

    • Version bumped to 8.0.5.
    • Updated dependencies to latest compatible versions.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 6, 2025

Walkthrough

Updates 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

Cohort / File(s) Summary
Version Updates
README.md, requirements.txt, src/slidedeckai/_version.py
Bumped SDK version in README front matter from 1.44.1 to 1.52.1; updated streamlit dependency from 1.52.0 to 1.52.1; incremented module version from 8.0.4 to 8.0.5
Error Handling & Logging
app.py, src/slidedeckai/core.py, src/slidedeckai/helpers/llm_helper.py
Refactored app.py progress streaming error handling to specifically detect litellm.AuthenticationError with focused error message and generic fallback for unexpected errors; changed logging level from logger.exception to logger.error in core.py and llm_helper.py exception handlers to reduce verbosity
Documentation & Configuration
src/slidedeckai/global_config.py
Updated provider descriptive text from "eight different providers" to "several providers"; modified documentation reference URL anchor from #summary-of-the-llms to #unmatched-flexibility-choose-your-ai-brain

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • app.py error handling refactoring: Verify litellm.AuthenticationError detection is correct and that the generic exception fallback properly handles all edge cases without losing important error context
  • Logging changes consistency: Ensure logger.error usage across core.py and llm_helper.py aligns with the error handling strategy in app.py and maintains sufficient diagnostic information

Possibly related PRs

Poem

🐰 A rabbit hops through code so neat,
Refining errors, making them fleet,
Quieter logs, less chatter and fuss,
Version bumps bring joy to us,
Auth errors now shine crystal clear! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: updating Streamlit dependency, reworking error handling, and bumping the version for release.
Linked Issues check ✅ Passed The PR successfully replaces logger.exception with logger.error in both app.py and src/slidedeckai/helpers/llm_helper.py, directly addressing issue #179's objective to reduce log verbosity.
Out of Scope Changes check ✅ Passed Most changes relate to the stated objectives, though some additions (Streamlit update, README/version changes, global_config text updates) extend slightly beyond the primary issue #179 scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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 visual

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.

@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

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

  1. Import litellm.AuthenticationError directly and use isinstance() checking
  2. Have the helper modules raise a custom exception (e.g., AuthenticationError) that wraps the litellm exception

That 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."""
    pass

Then 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4fb72 and b1fed52.

📒 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.py
  • src/slidedeckai/helpers/llm_helper.py
  • app.py
  • src/slidedeckai/global_config.py
  • src/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.exception to logger.error reduces 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.exception can 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.exception to logger.error is 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-brain correctly points to the corresponding section in README.md (line 84).

@barun-saha barun-saha merged commit 72225b3 into main Dec 6, 2025
7 checks passed
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.

Change logger.exception to logger.error

1 participant