litellm/tests/test_litellm/llms/bedrock
harish-berri a67b7a7e87
Some checks are pending
Unit Tests: Caching (Redis) / caching-redis (push) Waiting to run
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Waiting to run
Unit Tests: Proxy DB Operations / auth-checks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / budgets (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / custom-logging (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / db-and-spend (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-runtime (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / key-generation (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / logging-misc (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / schema-migration (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests: Security / security (push) Waiting to run
Refactor Bedrock response stream shape handling (#27257)
* Refactor Bedrock response stream shape handling

- Introduced a module-level constant `BEDROCK_RESPONSE_STREAM_SHAPE` to cache the response stream shape, eliminating the need for per-instance caching in `BedrockEventStreamDecoderBase`.
- Updated relevant methods to utilize the new constant, improving performance by avoiding redundant loading of the shape.
- Added tests to ensure the shape is loaded correctly at import time and is consistent across different modules.
- Added a new mock server script for testing Bedrock pass-through functionality.

* Refactor response parsing for Bedrock and SageMaker

- Improved code readability by formatting the parsing method calls in `AWSEventStreamDecoder` for both Bedrock and SageMaker response stream shapes.
- Added blank lines for better separation of code blocks in `invoke_handler.py` and `common_utils.py` to enhance maintainability.

* Enhance error handling for Bedrock and SageMaker response stream shape loading

- Wrapped the loading logic in `_load_bedrock_response_stream_shape` and `_load_sagemaker_response_stream_shape` with try-except blocks to gracefully handle exceptions.
- Added logging to warn when the response stream shape cannot be pre-loaded, ensuring the module imports cleanly.
- Updated tests to verify that loading failures return `None` instead of propagating exceptions.

* Implement error handling for missing response stream shapes in Bedrock and SageMaker

- Added checks in `_parse_message_from_event` methods to raise appropriate errors when `BEDROCK_RESPONSE_STREAM_SHAPE` or `SAGEMAKER_RESPONSE_STREAM_SHAPE` is None, ensuring clearer error reporting.
- Updated logging messages to reflect the unavailability of event-stream decoding for both Bedrock and SageMaker.
- Enhanced unit tests to verify that the correct exceptions are raised when the response stream shapes are not loaded.
2026-05-06 17:39:38 -07:00
..
chat refactor: remove unnecessary comments from #27074 2026-05-04 19:34:56 +00:00
count_tokens fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
embed style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
files harden cloud file compatibility path 2026-05-01 18:14:36 -07:00
image style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
image_edit Litellm ishaan april1 try2 (#25110) 2026-04-03 14:57:44 -07:00
invoke_agent fix: cover provider path traversal variants 2026-04-29 22:29:09 -07:00
messages/invoke_transformations refactor: remove unnecessary comments from #27074 2026-05-04 19:34:56 +00:00
passthrough style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
realtime style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
rerank style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
vector_stores fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
test_anthropic_beta_support.py fix(bedrock): allowlist Bedrock Invoke body fields and filter all anthropic-beta values 2026-04-21 11:26:15 -07:00
test_base_aws_llm.py refactor(BaseAWSLLM): implement shared IAM cache and static credentia… (#27125) 2026-05-05 16:47:47 -07:00
test_bedrock_common_utils.py Refactor Bedrock response stream shape handling (#27257) 2026-05-06 17:39:38 -07:00
test_bedrock_ssl_verify.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_cross_region_inference_profile_mapping.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mantle.py feat(bedrock): add support for bedrock-mantle endpoint (Claude Mythos Preview) (#26196) 2026-04-21 15:41:58 -07:00