litellm/tests/test_litellm/llms/openai
devin-ai-integration[bot] fa6b209165
feat(guardrails): add only_scan_new_messages for per-session incremental scanning (#33278)
* feat(guardrails): add only_scan_new_messages for per-session incremental scanning

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* fix(guardrails): use fixed TTL constant and revert unrelated test formatting

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* fix(guardrails): run only_scan_new_messages in the unified apply_guardrail path

The initial wiring lived in BedrockGuardrail.async_pre_call_hook, but the proxy
routes Bedrock through the unified apply_guardrail interface, so the flag had no
effect live. Move incremental selection into apply_guardrail: filter the flat
texts list against per-session scanned hashes, skip the Bedrock call when nothing
is new, and mark hashes only after a successful (non-blocked) scan. Full-context
fallback is preserved when there is no session id, the cache is unavailable, or a
masking guardrail is configured.

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* test(guardrails): cover session-id fallbacks and mark_texts_scanned guards

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* fix(guardrails): fall back to full scan when incremental guardrail masks content, use shared cache

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* test(guardrails): cover generic agent multi-turn incremental scan

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* test(guardrails): cover incremental scan cache resolver fallbacks

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* test(guardrails): cover flag interactions and /v1/messages incremental scan semantics

* feat(guardrails): make GUARDRAIL_SCANNED_MESSAGES_CACHE_TTL_SECONDS env configurable

* test(guardrails): prove skip_system/skip_tool are enforced upstream of incremental scan

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
Co-authored-by: Yucheng Zhu <yucheng@berri.ai>
2026-07-22 09:56:59 -07:00
..
chat feat(guardrails): add only_scan_new_messages for per-session incremental scanning (#33278) 2026-07-22 09:56:59 -07:00
completion Litellm oss 090626 (#30021) 2026-06-10 10:34:07 -07:00
embeddings/guardrail_translation style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
evals fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
image_generation test(image_generation): add tests for extra_headers propagation 2026-02-25 01:51:18 +08:00
realtime feat: litellm oss 110626 (#30202) 2026-06-11 22:30:26 -07:00
responses feat(guardrails): add Compresr guardrail for query-aware context compression (#33295) 2026-07-15 13:53:41 -07:00
speech fix(unified_guardrail.py): support during_call event type for unified guardrails (#17514) 2025-12-04 22:06:13 -08:00
transcriptions chore: litellm oss staging (#31185) 2026-06-26 09:17:44 -07:00
vector_store_files fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
vector_stores fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
videos fix(videos): encode the variant query param 2026-05-01 00:32:02 +00:00
test_data_residency.py feat(openai): apply regional-processing cost uplift for EU/US data residency (#28626) 2026-05-25 20:36:14 -07:00
test_gpt5_transformation.py Fix GPT-5 reasoning summary strip test path 2026-05-11 06:01:35 +00:00
test_is_model_gpt_5_model.py feat(models): add GPT-5.6 (sol/terra/luna) pricing and metadata (#32659) 2026-07-09 11:51:12 -07:00
test_o_series_transformation.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openai_common_utils.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openai_empty_response.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openai_file_content_streaming.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openai_image_edit_transformation.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_use_chat_completions_api_no_leak.py fix: stop use_chat_completions_api flag from leaking into provider request body (#29447) 2026-06-01 14:04:42 -07:00