fix: new URL for AWS Bedrock and model list support#4946
fix: new URL for AWS Bedrock and model list support#4946are-ces wants to merge 1 commit intollamastack:mainfrom
Conversation
|
Perhaps @skamenan7 can join the conversation |
stack implements its
this is a good issue to file. does switching the endpoint get tool calling to work? |
|
Tool working does not work, you can check this notebook. With the mantle endpoint it works. |
|
@skamenan7 what are the errors when using tools w/ the existing bedrock provider? |
Hi @mattf , with the current bedrock-runtime endpoint, sending ps: I away few days, hence late reply. |
| return await super().list_provider_model_ids() | ||
| except Exception as e: | ||
| logger.debug(f"Failed to list Bedrock models dynamically: {e}") | ||
| return [] |
There was a problem hiding this comment.
I might be wrong on this, but I think returning [] on failure could cause model registry churn? ModelsRoutingTable.refresh() treats the result as authoritative, so on a transient 401/5xx it'd call update_registered_models(..., models=[]) and unregister all bedrock models.
Users'd see intermittent "model not found" until the next successful refresh.
If that's right, letting the exception propagate might be the simplest fix as refresh() already catches exceptions from list_models(). Or
narrowing the catch to only NotFoundError / APIConnectionError would also work, right?
| return [] | ||
| try: | ||
| return await super().list_provider_model_ids() | ||
| except Exception as e: |
There was a problem hiding this comment.
One thing I noticed that except Exception catches AuthenticationError too, so if someone's credentials are wrong they'd get an empty model list with a debug-level log instead of finding out right away. They wouldn't see the actual auth error until they try a chat completion.
Also the parent list_models() already has a try/except that logs at error level and re-raises, but this catch fires first and prevents that
from kicking in.
Narrowing to APIConnectionError / NotFoundError might be cleaner? That way auth failures still surface. Or bumping to warning at minimum so it's not invisible.
| logger.debug(f"Failed to list Bedrock models dynamically: {e}") | ||
| return [] | ||
|
|
||
| async def check_model_availability(self, model: str) -> bool: |
There was a problem hiding this comment.
isn't the parent check_model_availability already handle the empty-cache case. The only
extra thing this override seems to do is force cache population when model_store already has the model, isn't it? is there a downstream operation that depends on that?
If not, removing the override might be simpler.
|
nit: the new |
that's terrible. i hope you have a route to file a bug against bedrock. does moving to the new endpoint resolve this? |
|
Hi @mattf, I just tested both endpoints directly with SigV4 auth and tools param, and tool calling works on both now — bedrock-runtime returned finish_reason: "tool_calls" with the correct function call, no hang. Looks like AWS fixed it since my Oct testing. I did not get a chance to test it again since then. But @are-ces change also has /v1/models support (old endpoint returns empty, mantle lists 30+ models) and a much bigger model catalog (DeepSeek, Mistral, Qwen, Gemma alongside GPT-OSS). The list_provider_model_ids() change makes sense with mantle since /v1/models actually returns data there. |
that's good news.
i don't have an environment to test this. will you do the review, verify it works, doesn't introduce any regressions, has a good user experience, and i'll mash merge? |
|
Sure, @mattf, I will run through by these criteria and let you know. |
|
Ran through this carefully @mattf. The core change is right — mantle endpoint confirmed working for tool calling, Two things worth addressing before merge:
If @are-ces addresses these I will check again and provide feedback |
|
Hi! I will address all issues asap 👍 |
Fix integration tests
|
@skamenan7 I have addressed your point removing the overrides, they were indeed not needed. |


What does this PR do?
The official endpoint for AWS Bedrock has changed according to AWS Documentation
This new endpoint supports the /v1/models endpoint, thus I added the method for listing models too.
Test Plan
Call Responses API with AWS Bedrock; list models