mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
* fix(guardrails): add /v1/messages support for Straiker plugin - Pass prepared response data to Anthropic Messages streaming post-call hooks (litellm/llms/anthropic/chat/guardrail_translation/handler.py) - Normalize Straiker request, tool, finish-reason, and mode fields across Chat Completions, Messages, and Responses APIs * fix(guardrails): gate cross-surface message resolution and cover streaming request data Resolve request messages only for surfaces that have a mapped translation handler. The unguarded fallback tried every registered handler in turn, which raised AttributeError out of the guardrail's error handling on list-shaped `input` bodies, and synthesized a chat message that was never sent for bodies it happened to parse. Prepare request data on the mid-stream Anthropic branch as well, matching the terminal branch and the OpenAI handler, so guardrails that scan before end-of-stream still receive identity metadata. Read usage from Anthropic dict responses so non-streaming /v1/messages reports token counts instead of null. Add regression coverage for the streaming request data on both the terminal and mid-stream branches; reverting either now fails. --------- Co-authored-by: cs-mehta <chandra@straiker.ai> |
||
|---|---|---|
| .. | ||
| batches | ||
| chat | ||
| experimental_pass_through | ||
| files | ||
| messages | ||
| __init__.py | ||
| test_anthropic_common_utils.py | ||
| test_anthropic_count_tokens_transformation.py | ||
| test_anthropic_files_and_batches.py | ||
| test_anthropic_output_format_filter.py | ||
| test_anthropic_structured_output.py | ||
| test_azure_ai_cache_pricing.py | ||
| test_cost_calculation_dict_safety.py | ||
| test_count_tokens_oauth.py | ||
| test_message_sanitization.py | ||