Skip to content

$#431

Merged
xtsea merged 3 commits into
betafrom
dev
Oct 4, 2025
Merged

$#431
xtsea merged 3 commits into
betafrom
dev

Conversation

@xtsea

@xtsea xtsea commented Oct 4, 2025

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Enforce API key validation for Ryzenth client initialization with proper bearer authorization and clean up README by removing outdated FAQ and updating example credentials

Enhancements:

  • Require a valid API key from parent attribute or RYZENTH_API_KEY environment variable before initializing the client
  • Inject the API key as a Bearer token in the RyzenthApiClient authorization header and raise AuthenticationError on invalid or missing key

Documentation:

  • Remove the outdated FAQ section about free trial
  • Update the JavaScript example to use a placeholder for the required API key

@sourcery-ai

sourcery-ai Bot commented Oct 4, 2025

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR centralizes and validates API key handling for the Ryzenth client and aligns documentation with the new authentication requirements.

Class diagram for updated API key handling in Ryzenth client

classDiagram
    class _default_chats {
        - parent
        - _client
        + _get_client() RyzenthApiClient
    }
    class RyzenthApiClient {
        + tools_name
        + api_key
        + rate_limit
        + use_default_headers
    }
    class AuthenticationError
    _default_chats --> RyzenthApiClient : uses
    _default_chats --> AuthenticationError : raises
    _default_chats : +_get_client() now validates api_key
    _default_chats : +_get_client() raises AuthenticationError if api_key missing/invalid
    RyzenthApiClient : +api_key expects {"ryzenth-v2": [{"Authorization": "Bearer <api_key>"}]}
Loading

Flow diagram for API key retrieval and validation

flowchart TD
    A["_get_client() called"] --> B["Check if _client is None"]
    B --> C["Retrieve api_key from parent._api_key or RYZENTH_API_KEY env"]
    C --> D{"Is api_key valid?"}
    D -- No --> E["Raise AuthenticationError"]
    D -- Yes --> F["Initialize RyzenthApiClient with api_key"]
    F --> G["Assign to self._client"]
Loading

File-Level Changes

Change Details Files
Introduce and validate API key retrieval logic for the Ryzenth client
  • Fetch API key from parent attribute or environment variable
  • Validate the key and raise AuthenticationError if missing or invalid
  • Pass the Bearer token in the Authorization header to RyzenthApiClient
Ryzenth/new_helper/_default_chats.py
Clean up and update documentation to reflect authentication changes
  • Remove outdated FAQ section
  • Update JavaScript code sample to require a valid API key
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@xtsea xtsea merged commit 4fcd44a into beta Oct 4, 2025
5 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.

1 participant