Files
langchaingo/llms
Sergey Kozyrenko 2ab7977c19 fix(bedrock): refuse the turns the primary Anthropic door already refuses
Two conversations are rejected locally on the Anthropic door and were sent
anyway on both Bedrock doors: one ending in an assistant turn on a model that
does not take a prefill, and a forced tool choice combined with manual budget
thinking. Each cost a round trip to come back as a documented 400.

Both refusals now run once in the Bedrock entry point, ahead of the split
between InvokeModel and Converse, so the two transports answer alike. The
predicates are model-keyed, so a non-Claude id such as Amazon Nova passes
through untouched.

The two error types move to llms/reasoning, which both doors already import, and
the anthropic package keeps its names as aliases so existing callers and their
errors.As checks are unaffected. The prefill and forced-tool detectors move to
llms beside the types they inspect, replacing the anthropic-private copies.

Verified by mutation: removing the guard reddens all four rows.

PAGI-132

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-23 23:55:13 +07:00
..
2025-06-22 02:27:21 +03:00