Rename tool output compression parallelism env

This commit is contained in:
jamesx0416 2026-06-04 14:54:21 +10:00
parent 4c86826eab
commit cfcaf0e364
3 changed files with 7 additions and 7 deletions

View file

@ -52,7 +52,7 @@ logger = logging.getLogger("headroom.proxy")
_OPENAI_RESPONSES_UNIT_CACHE_MAX_ENTRIES = 10_000
_OPENAI_RESPONSES_UNIT_CACHE_VERSION = "openai_responses_unit_v1"
_OPENAI_RESPONSES_UNIT_PARALLELISM_ENV = "HEADROOM_OPENAI_RESPONSES_UNIT_PARALLELISM"
_OPENAI_RESPONSES_UNIT_PARALLELISM_ENV = "HEADROOM_TOOL_OUTPUT_COMPRESSION_PARALLELISM"
_OPENAI_RESPONSES_UNIT_PARALLELISM_DEFAULT = 4
_OPENAI_RESPONSES_UNIT_PARALLELISM_MAX = 16
_OPENAI_RESPONSES_UNIT_CACHE_INIT_LOCK = threading.RLock()

View file

@ -28,16 +28,16 @@ def _handler_with_router(router: ContentRouter) -> OpenAIHandlerMixin:
def test_openai_responses_unit_parallelism_env_defaults_and_clamps(monkeypatch):
monkeypatch.delenv("HEADROOM_OPENAI_RESPONSES_UNIT_PARALLELISM", raising=False)
monkeypatch.delenv("HEADROOM_TOOL_OUTPUT_COMPRESSION_PARALLELISM", raising=False)
assert openai_handler._openai_responses_unit_parallelism() == 4
monkeypatch.setenv("HEADROOM_OPENAI_RESPONSES_UNIT_PARALLELISM", "bad")
monkeypatch.setenv("HEADROOM_TOOL_OUTPUT_COMPRESSION_PARALLELISM", "bad")
assert openai_handler._openai_responses_unit_parallelism() == 4
monkeypatch.setenv("HEADROOM_OPENAI_RESPONSES_UNIT_PARALLELISM", "0")
monkeypatch.setenv("HEADROOM_TOOL_OUTPUT_COMPRESSION_PARALLELISM", "0")
assert openai_handler._openai_responses_unit_parallelism() == 1
monkeypatch.setenv("HEADROOM_OPENAI_RESPONSES_UNIT_PARALLELISM", "999")
monkeypatch.setenv("HEADROOM_TOOL_OUTPUT_COMPRESSION_PARALLELISM", "999")
assert openai_handler._openai_responses_unit_parallelism() == 16
@ -271,7 +271,7 @@ def test_openai_responses_adapter_reuses_identical_tool_output_in_same_request()
def test_openai_responses_adapter_parallelizes_cache_misses_preserving_order(monkeypatch):
monkeypatch.setenv("HEADROOM_OPENAI_RESPONSES_UNIT_PARALLELISM", "4")
monkeypatch.setenv("HEADROOM_TOOL_OUTPUT_COMPRESSION_PARALLELISM", "4")
router = ContentRouter()
lock = threading.Lock()
release = threading.Event()

View file

@ -96,7 +96,7 @@ def _json_bytes(value: object) -> int:
def test_t3_failed_size_responses_payload_parallelizes_uncached_tool_outputs(monkeypatch):
monkeypatch.setenv("HEADROOM_OPENAI_RESPONSES_UNIT_PARALLELISM", "4")
monkeypatch.setenv("HEADROOM_TOOL_OUTPUT_COMPRESSION_PARALLELISM", "4")
case = T3_FAILED_CASES[0]
router = ContentRouter()
lock = threading.Lock()