litellm/tests/test_litellm/llms/openai/chat
Alexander Grattan cc76f95555
fix: check for model_response_choices before guardrail input (#19784)
* fix: check for model_response_choices before guardrail input

* test: add tests for responses api translation

* fix: protect other guardrail translations

* refactor: remove type ignores

* anthropic request body got mutated fix

* add warning when extra_body is provided but user is non premium

* fix: resolve mypy union-attr errors in anthropic guardrail handler

Cast choices[0] to Choices type before accessing .message attribute
to satisfy mypy's union type checking for Choices | StreamingChoices.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* add logger when model response has no choices for streaming /response and /messages

* update pyproject.toml as requested

* Revert "update pyproject.toml as requested"

This reverts commit 541a2b075a.

* update pyproject.toml as requested

* Revert "update pyproject.toml as requested"

This reverts commit 716ea0caa1.

---------

Co-authored-by: Xiaohan Fu <xiaohan@grayswan.ai>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 14:41:13 -08:00
..
guardrail_translation fix: check for model_response_choices before guardrail input (#19784) 2026-02-03 14:41:13 -08:00
__init__.py Guardrail API - support tool call checks on OpenAI /chat/completions, OpenAI /responses, Anthropic /v1/messages (#17459) 2025-12-03 21:20:39 -08:00
test_openai_gpt_transformation.py fix(openai): include 'user' param for responses API models (#17648) 2025-12-08 18:52:47 -08:00