Skip to content
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

Addition of Error Flags: retriable and fatal #1533

Merged
merged 3 commits into from
May 8, 2023
Merged

Conversation

JosselinSomervilleRoberts
Copy link
Contributor

Added ErrorFlags to handle errors that are consistent but not fatal.
This is used for Palmyra's content filtering.
For now handles #1520.

Copy link
Collaborator

@yifanmai yifanmai left a comment

Choose a reason for hiding this comment

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

Looks good! Minor suggestions only.

src/helm/proxy/clients/anthropic_client.py Outdated Show resolved Hide resolved
src/helm/proxy/clients/anthropic_client.py Outdated Show resolved Hide resolved
@@ -48,7 +48,13 @@ def retry_if_request_failed(result: Union[RequestResult, TokenizationRequestResu
"""Fails if `success` of `RequestResult` or `TokenizationRequestResult` is false."""
if not result.success:
hlog(result.error)
return not result.success
retry_if_fail: bool = (
not hasattr(result, "error_flags")
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't think this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is because TokenizationRequestResult has no error_flages.
At some point I added the error_flags to TokenizationRequestResult but since it was not used, I thought it was bad practice.
Additionally, I seem to remember seeing that this function is called with other results than just RequestResult and TokenizationRequestResult (I think it was DecodeRequestResult). In the end, it became a nightmare to add these error_flags everywhere, so I thought this was a clean solution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it to isinstance(result, RequestResult)

src/helm/benchmark/executor.py Outdated Show resolved Hide resolved
src/helm/common/request.py Outdated Show resolved Hide resolved
src/helm/common/request.py Outdated Show resolved Hide resolved
src/helm/common/request.py Outdated Show resolved Hide resolved
@yifanmai
Copy link
Collaborator

yifanmai commented May 8, 2023

@JosselinSomervilleRoberts this is nearly ready; let's get this merged soon

@JosselinSomervilleRoberts
Copy link
Contributor Author

Should be good now. @yifanmai do you want to check just before I merge?

@yifanmai
Copy link
Collaborator

yifanmai commented May 8, 2023

Looks good!

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.

2 participants