mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-26 22:30:11 +00:00
* fix(guardrails): classify only the frames each read completes in Presidio's first-frame wait Presidio's wait for the first frame with a JSON object re-split and re-classified its whole buffer on every read, so a long run of leading non-object frames cost CPU quadratic in the number of reads. It now buffers in a bytearray, finds frame ends only in the newly read bytes, and classifies only the frames that read completed * test(guardrails): check Presidio's first-frame wait classifies each byte once instead of timing it The test guide bans checks that depend on execution speed, so the CPU-time limit on the many-leading-reads test is replaced by a test that each read is handed only the frames it completed, including frame ends split across reads * test(guardrails): drive Presidio's real first-frame wait in its per-read classification test The test copied the wait's loop, so it still passed if the wait itself dropped the offset the classifier returns. The wait now takes the classifier as a parameter, defaulting to the one it called before, and the test runs the real wait with a recording classifier. The classifier docstring now says the caller relays the preface * test(benchmarks): benchmark Presidio's first-frame wait over many leading reads and a frame split into many reads Unit tests can't check the wait's cost without timing it, so CodSpeed now times the real wait over 6000 leading non-object reads and over one 48 KB frame in 16-byte reads. Rescanning every classified frame for a JSON object, or searching the whole unclassified tail for a frame end, makes these runs many times slower * test(proxy): check the SSE frame-end search directly --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| conftest.py | ||
| test_a2a_benchmarks.py | ||
| test_benchmarks.py | ||
| test_count_tokens_benchmarks.py | ||
| test_extraction_guardrail_benchmarks.py | ||
| test_inference_benchmarks.py | ||
| test_json_fragment_accumulator_benchmarks.py | ||
| test_mcp_benchmarks.py | ||
| test_presidio_benchmarks.py | ||
| test_prompt_template_benchmarks.py | ||
| test_realtime_session_merge_benchmarks.py | ||
| test_responses_compaction_benchmarks.py | ||
| test_sse_lines_benchmarks.py | ||
| test_token_counter_pdf_benchmarks.py | ||