-
Notifications
You must be signed in to change notification settings - Fork 326
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
fix: Run Bedrock calls in executor for async #3884
Conversation
691ffd2
to
7efc3e8
Compare
@lou-k Thanks so much for the contribution! Because we don't have comprehensive testing around our model wrappers before we can merge this I was hoping we could check (or even explicitly test) the following cases:
If we can confirm all of this behavior is preserved this seems like a great idea! |
@anticorrelator thanks for the feedback! I'll run these tests this week and share results. |
bc9ada5
to
82c3e82
Compare
Yes, confirmed locally by running the toxicity eval in a script
Yes, confirmed locally by running the toxicity benchmark notebook
I've added a unit test that confirms errors are throln from the async call
Yes, but it's worth calling out that calls to claude2 don't work properly with Bedrock's instrumentation right now since the code assumes a I noticed tox is failing but I can't seem to find the error message -- can you see it? |
@lou-k Thanks for checking! Let me try running tox locally on your branch |
@lou-k looks like the import block needs formatting
If you run the ruff formatter everything should be good to go: |
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.
Thank you so much!
Ahh thanks! I'm new to |
1fe6dfb
to
00bbf63
Compare
I believe this is ready to merge :highfive: |
Wraps synchronous calls in an executor for async support in Bedrock evals.
The current code makes a synchronous call in an async function. As a result, calling
run_evals
:gather
. This confuses the user and makes them think something is wrong.Proper async support in boto3 has been asked for for years, so I don't think we can count on it any time soon. Wrapping in an executor ties up some threads on I/O, but still results in significantly higher throughput, which I think eval users (including myself) require.