-
Notifications
You must be signed in to change notification settings - Fork 2
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
CERT-7874 Handle LLM key crash #51
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: yoav-el-certora <[email protected]>
This comment will trigger CI? |
yoav-el-certora
previously approved these changes
Dec 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://certora.atlassian.net/browse/CERT-7874
Summary of Changes
Purpose:
Enhance the application's robustness by handling scenarios where the Anthropic API key (
ANTHROPIC_API_KEY
) is not configured. This ensures that dependent checks are gracefully skipped, and users are appropriately informed.1.
Quorum/checks/new_listing.py
Imported Configuration Module:
import Quorum.config as config
to access configuration settings.Conditional Execution in
NewListingCheck
:ANTHROPIC_API_KEY
is not set in the environment:Displays a warning message indicating that the first deposit check is skipped due to the missing API key.
Exits the
new_listing_check
method early to prevent executing dependent checks without the necessary API key.Impact:
Prevents the tool from attempting to perform operations that rely on the Anthropic API when the API key is not available, thereby avoiding potential errors and informing the user of the skipped functionality.
2.
Quorum/config.py
Imported Pretty Printer:
import Quorum.utils.pretty_printer as pp
to utilize the pretty printing utility for displaying messages.Configuration Validation for Anthropic API Key:
ANTHROPIC_API_KEY
:ANTHROPIC_API_KEY
is not set:Displays a warning message informing the user that the
ANTHROPIC_API_KEY
environment variable is not set and that all dependent checks will be skipped.Impact:
Alerts users during the configuration phase if the Anthropic API key is missing, ensuring they are aware that certain features will not be available until the API key is provided.
Overall Benefits:
Improved User Experience:
Users receive clear and immediate feedback about missing configurations, preventing confusion and unexpected behavior.
Enhanced Stability:
By conditionally skipping dependent checks when necessary, the application avoids runtime errors and maintains smooth operation.
Maintainable Codebase:
Centralizing the API key check in the configuration and conditionally handling it in dependent modules promotes cleaner and more maintainable code.
Example Warning Messages:
From
config.py
:From
new_listing.py
: