-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(bedrock.py): Add Cloudflare AI Gateway support #3467
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
please add a test for this @Manouchehri - want to make sure no regressions occur. I believe you can mock bedrock calls
91cd1a6
to
d8b5905
Compare
I added a test, let me know if it fails. =) |
cd litellm/tests/
poetry run pytest test_bedrock_completion.py::test_completion_bedrock_cloudflare_ai_gateway -s -v Confirmed, it passes. =) |
@@ -607,6 +621,11 @@ def init_bedrock_client( | |||
else: | |||
endpoint_url = f"https://bedrock-runtime.{region_name}.amazonaws.com" | |||
|
|||
real_endpoint_url = None |
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.
please can we not have 2 floating variables both with 'endpoint_url' :D
is it possible for us to have cloudflare logic in 'cloudflare.py' and just have that function wrap this?
having the cloudflare logic in here, looks like it complicates 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.
we could enforce types on functions in here, so any wrapper function can always know what it's going to get
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.
Hmm, isn't having a floating variable the easiest way of doing this? :)
We could separate the logic out, but it's very Bedrock + Cloudflare AI Gateway specific. e.g. the code for Azure OpenAI + Cloudflare AI Gateway is totally different.
Title
This adds Cloudflare AI Gateway support for Bedrock.
Relevant issues
Resolves #1040.
Type
🆕 New Feature
🚄 Infrastructure
Changes
We add a boto3 hook to modify the URL after signing, but before invoking.
Testing
Notes
Cloudflare AI Gateway seems to break support for streaming at the moment, not sure why.
Pre-Submission Checklist (optional but appreciated):
OS Tests (optional but appreciated):