mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* fix(anthropic): answer 400 naming a malformed thinking_blocks instead of 500 A non-list thinking_blocks on an assistant turn, or a list holding a non-object, crashed the Anthropic message conversion with an AttributeError that surfaced as a 500. It now answers a 400 naming the field, and under drop_params the malformed value is dropped instead. * fix(anthropic): accept every sequence of thinking blocks and drop only malformed entries A deque or other non-list sequence of valid blocks keeps replaying instead of answering 400, and drop_params keeps its valid signed blocks. * fix(anthropic): keep replaying thinking blocks from any iterable Generators, iterators and dict views of valid blocks answered 200 before the validation, so they stay untouched. Reading the enum items before narrowing also removes one unknown-type diagnostic. * fix(anthropic): reject thinking_blocks only when they reach the translated request The check now runs after translation, so a request that worked before keeps working whatever shape its thinking_blocks has. The 400 naming the field, or the drop under drop_params, applies only when translation fails or leaves a content block the request builder cannot read * fix(anthropic): name malformed thinking_blocks only when they cause the failure Translate again without the malformed blocks and keep the original error when that still fails. Keep valid one-shot blocks under drop_params, handle nested stream keys, recheck the thinking param after a cleanup, and answer 400 for a numeric thinking_blocks on Bedrock Converse * fix(anthropic): check malformed thinking_blocks without fetching remote media A malformed thinking_blocks is now proven the cause with placeholder media, so a rejected request downloads nothing and every other request downloads once. Non-string block types and iterators are covered, and Bedrock Claude batch rows honor drop_params. * fix(anthropic): treat a thinking block with no type like one whose type is not a string A typeless block on string content now answers our 400 naming messages[i].thinking_blocks[j].type, and drop_params drops it, instead of sending it to Claude. The tests read replayed blocks through a TypeAdapter instead of bare dicts * fix(anthropic): check malformed thinking_blocks without downloading a remote file_data URL The probe that decides whether a malformed thinking_blocks is at fault swapped remote image URLs for a placeholder but left a file part's remote file_data URL in place, so a rejected or dropped request downloaded that file once more per translation. A remote file_data URL now gets the same placeholder, so the check downloads nothing and the sent request downloads the file once --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| expected_bedrock_batch_completions.jsonl | ||
| expected_bedrock_batch_embeddings.jsonl | ||
| input_batch_completions.jsonl | ||
| input_batch_embeddings.jsonl | ||
| test_bedrock_files_handler.py | ||
| test_bedrock_files_transformation.py | ||