-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Bedrock: workaround LiteLLM passthrough issues #6778
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
Conversation
Explicitly setting requestTimeout seems to be required for it to be possible to use the Bedrock provider with LiteLLM Bedrock passthrough.
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 for your contribution! I've reviewed the changes and have some suggestions for improvement. The workaround appears functional, but understanding the root cause better and considering potential side effects would strengthen this fix.
| clientConfig.requestHandler = { | ||
| // This should be the default anyway, but without setting something | ||
| // this provider fails to work with LiteLLM passthrough. | ||
| requestTimeout: 0, |
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 comment mentions "This should be the default anyway" but it's unclear why explicitly setting requestTimeout: 0 fixes the LiteLLM issue. Could you provide more context about what was happening without this setting? Was LiteLLM timing out immediately, or was there a different default being applied?
Also, setting requestTimeout: 0 means no timeout limit. While this fixes the immediate issue, could this potentially cause requests to hang indefinitely in certain failure scenarios? Would a reasonable timeout value (e.g., 300000 for 5 minutes) work instead?
| // This should be the default anyway, but without setting something | ||
| // this provider fails to work with LiteLLM passthrough. | ||
| requestTimeout: 0, | ||
| } |
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.
Since this is a workaround for a specific LiteLLM passthrough issue, consider adding a test case that verifies the requestHandler configuration is properly set when using API key authentication. This would prevent regression if the code is refactored in the future.
Also, would it make sense to add a configuration option like awsLiteLLMCompatibilityMode so users can explicitly enable this workaround only when needed?
Explicitly setting
requestTimeoutseems to be required for it to be possible to use the Bedrock provider with LiteLLMBedrock passthrough.
Example litellm config: https://gist.github.com/jr/bb8188c29719adb27565cffe45e0b5c3 Without this change trying to connect to LiteLLM using the bedrock provider with Bedrock API Key "sk-my_special_key" and custom VPC endpoint http://localhost:4000/bedrock will quickly fail. Seems like the requests are failing immediately for some reason.
I would love it if someone understood this more deeply, because it seems crazy.
Important
Adds
requestTimeout: 0toAwsBedrockHandlerinbedrock.tsto fix LiteLLM passthrough issues.requestTimeout: 0toclientConfig.requestHandlerinAwsBedrockHandlerinbedrock.tsto ensure compatibility with LiteLLM passthrough.This description was created by
for 9228a91. You can customize this summary. It will automatically update as commits are pushed.