-
Notifications
You must be signed in to change notification settings - Fork 10
adding response quality validation for retry #344
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: main
Are you sure you want to change the base?
adding response quality validation for retry #344
Conversation
tests/test_retry_mechanism.py
Outdated
| mode="pointwise", | ||
| exception_handler_config=ExceptionHandlerConfig( | ||
| backoff_config=BackoffConfig(max_tries=3, base_delay=0.1, strategy="constant"), | ||
| exception_backoff_overrides={ |
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.
will the default backoff retry logic not fit in this case? is it necessary to override it for quality 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.
Default will backoff, but I imagine we don't want to backoff in quality case. Though if we unify them the code complexity will be much smaller
| if config.post_processor is not None: | ||
| try: | ||
| config.post_processor.process(result) | ||
| except ResponseQualityError as quality_error: | ||
| # Re-raise ResponseQualityError to trigger retry logic | ||
| raise quality_error | ||
| except Exception as post_process_error: | ||
| # Wrap unexpected post-processor errors in ResponseQualityError | ||
| raise ResponseQualityError(f"Post-processor failed: {post_process_error}") from post_process_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.
so all errors are ResponseQualityError if a post_processor is set?
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.
My bad, let me change this
dphuang2
left a comment
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.
can we make sure this works with remote rollout processor?
3d209f5 to
2eeb478
Compare
name: Adding response quality validation for retry
about: response quality validation for retryable error
title: "Adding response quality validation for retry"
labels: ''
assignees: ''
Description
For bad rollouts that makes the final output bad which has quality issues, eg, gibberish, repetitions, etc, fail it with this plugin with customizations. Default no-op
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
Test with current tests and added decorator tests
Checklist:
black .,isort .,flake8 .)Screenshots (if applicable)
If applicable, add screenshots to help showcase your changes.
Additional context
Add any other context about the PR here.
Note
Introduces
RESPONSE_QUALITY_ERROR(103) and a post-processing hook to validate rollout results and trigger retries; updates retry config and adds tests.ResponseQualityError(code103) ineval_protocol/exceptions.pyand map inSTATUS_CODE_TO_EXCEPTION.Status.CodewithRESPONSE_QUALITY_ERRORand addStatus.response_quality_error()ineval_protocol/models.py.eval_protocol/pytest/rollout_result_post_processor.pywithRolloutResultPostProcessorandNoOpRolloutResultPostProcessor(exported ineval_protocol/pytest/__init__.py).post_processortoRolloutProcessorConfigineval_protocol/pytest/types.py.evaluation_test_utils.rollout_processor_with_retry(); raisingResponseQualityErrortriggers backoff retries.ResponseQualityErrorinDEFAULT_RETRYABLE_EXCEPTIONSand minor typing/format adjustments ineval_protocol/pytest/exception_config.py.tests/test_exception_config.pycovering backoff decorator and inclusion ofResponseQualityError.tests/test_exceptions.pyfor code103mapping and behavior.tests/test_retry_mechanism.pywith scenarios verifying retry onResponseQualityError.Written by Cursor Bugbot for commit 2eeb478. This will update automatically on new commits. Configure here.