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

[Bug]: bedrock fallback not working #7637

Open
zegerius opened this issue Jan 8, 2025 · 0 comments
Open

[Bug]: bedrock fallback not working #7637

zegerius opened this issue Jan 8, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@zegerius
Copy link

zegerius commented Jan 8, 2025

What happened?

While using Bedrock with Claude Sonnet 3.5 v2, I see a lot of the following in my application:

openai.APIError: litellm.APIConnectionError: Bad response code, expected 200: {'status_code': 400, 'headers': {':exception-type': 'serviceUnavailableException', ':content-type': 'application/json', ':message-type': 'exception'}, 'body': b'{"message":"Bedrock is unable to process your request."}'}

The combination of a 400 and ServiceUnavailable seems to be impossible and the error message is quite useless. https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html

These errors occur seemingly randomly, and moments later the same requests works fine. I have configured fallbacks in my configuration:

model_list:
    litellm_params:
      model: bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0
      aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID
      aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY
      aws_region_name: os.environ/AWS_DEFAULT_REGION
  - model_name: bedrock-claude-haiku-35-v1
    litellm_params:
      model: bedrock/anthropic.claude-3-5-haiku-20241022-v1:0
      aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID
      aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY
      aws_region_name: os.environ/AWS_DEFAULT_REGION
router_settings:
  fallbacks: [{"bedrock-claude-sonnet-35-v2": ["bedrock-claude-haiku-35-v1"]}]

I also tested

        litellm_client = openai.AsyncOpenAI(
            api_key=settings.litellm_api_key, base_url=settings.litellm_url
        )
        ...
        response = await litellm_client.chat.completions.create(
            model=model_slug,
            user=str(user_id),
            temperature=settings.litellm_model_temp,
            top_p=settings.litellm_model_top_p,
            messages=messages,
            stream=True,
            metadata={"tags": ["thread"]},
            extra_body={"fallbacks": ["bedrock-claude-haiku-35-v1", "gemini-1-5-pro"]},
        )

The documentation on fallbacks this way is quite sparse.

I ran LiteLLM in debug mode with the most verbose logging I have seen in a while, but I don't see a mention of retries.

Having debugged this for days now, I am not sure what is left.

Relevant log output

No response

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

v1.57.3

Twitter / LinkedIn details

No response

@zegerius zegerius added the bug Something isn't working label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant