-
Notifications
You must be signed in to change notification settings - Fork 87
Rishi/overwrite message #615
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
base: staging
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @rishi763, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the user experience for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with π and π on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request significantly improves the user experience for the upload_scorer CLI command by adding a specific error message for duplicate scorers, guiding the user to use the --overwrite flag. The refactoring of error handling to move logging from the library to the CLI layer is a solid design choice that improves separation of concerns. The changes are logical and enhance the tool's usability.
src/judgeval/cli.py
Outdated
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.
The new exception handling correctly identifies the 409 Conflict error and provides a helpful message. However, it only handles this specific API error. Other API errors (like 401 Unauthorized or 403 Forbidden) will be re-raised, resulting in a full traceback being shown to the user, which isn't ideal for a CLI tool. It would be more robust to handle all JudgmentAPIError exceptions gracefully and provide the user with the specific error detail from the API response, while letting other unexpected exceptions show a full traceback.
| except Exception as e: | |
| if isinstance(e, JudgmentAPIError) and e.status_code == 409: | |
| judgeval_logger.error("Duplicate scorer detected. Use --overwrite flag to replace the existing scorer") | |
| raise typer.Exit(1) | |
| # Re-raise other exceptions | |
| raise | |
| except JudgmentAPIError as e: | |
| if e.status_code == 409: | |
| judgeval_logger.error("Duplicate scorer detected. Use --overwrite flag to replace the existing scorer") | |
| else: | |
| judgeval_logger.error(f"Failed to upload custom scorer. API Error: {e.detail}") | |
| raise typer.Exit(1) | |
| except Exception: | |
| # Re-raise other exceptions for Typer to handle (e.g., ValueError from parsing) | |
| raise |
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.
did you mean to change this?
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.
Abhi made this change
| raise typer.Exit(0) | ||
| except Exception: | ||
| except Exception as e: | ||
| if isinstance(e, JudgmentAPIError) and e.status_code == 409: |
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.
is this right? i dont think backend throws this kind of error?
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.
lgmt
|
βοΈ Propel has finished reviewing this change. |
π Summary
β Checklist