mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-04 01:48:57 +00:00
* fix(guardrails): keep streamed chat chunks as JSON when Azure text moderation passes * fix(guardrails): skip whitespace-only text in the Azure text moderation streaming hook Azure Content Safety answers whitespace-only text with a 400, which ended the stream with an error event * fix(guardrails): keep streamed chat chunks as JSON when LLM Guard passes The LLM Guard streaming hook returned the text it checked, and the proxy replaces a chunk with any value a streaming hook returns, so every chunk went out as bare text * fix(guardrails): give Azure text moderation's streamed block event a readable message The block event now uses the same error shape as other proxy errors, so the OpenAI SDK shows the Azure reason instead of a generic streaming error. Tests stream a banned word split across two chunks through both the Azure and LLM Guard hooks * fix(proxy): skip streaming hooks for chunks that add no text Tool-call, role-only and finish chunks add no text, so asking a streaming hook about them sent guardrails like Azure text moderation the same text again on every tool-call chunk. The token-id drop still runs on them * fix(guardrails): raise Azure text moderation streaming blocks so the proxy's failure path handles them |
||
|---|---|---|
| .. | ||
| helpers | ||
| prisma_and_spend | ||
| proxy_logging | ||
| __init__.py | ||