headroom/tests/test_proxy/test_openai_chat_ccr_injection.py
Tejas Chopra d0c1f5b8ad
fix(ccr): avoid injecting tool on chat streaming
Avoid unsupported CCR tool injection on OpenAI chat streaming (#2924).
2026-08-11 16:18:57 -07:00

16 lines
703 B
Python

"""Streaming chat CCR injection must not advertise an unredeemable tool."""
from headroom.proxy.handlers.openai import _should_inject_openai_chat_ccr_tool
def test_streaming_chat_does_not_inject_ccr_tool() -> None:
assert _should_inject_openai_chat_ccr_tool(ccr_inject_tool=True, stream=True) is False
def test_non_streaming_chat_still_injects_ccr_tool() -> None:
assert _should_inject_openai_chat_ccr_tool(ccr_inject_tool=True, stream=False) is True
def test_disabled_ccr_never_injects_tool() -> None:
assert _should_inject_openai_chat_ccr_tool(ccr_inject_tool=False, stream=False) is False
assert _should_inject_openai_chat_ccr_tool(ccr_inject_tool=False, stream=True) is False