litellm/tests
giladk1221 a8ebf477a8
fix(github_copilot): convert plain-text documents for native messages (#53554)
* fix(github_copilot): convert plain-text documents for native messages

* fix(github_copilot): skip empty text documents and honor drop_params for citations

An empty untitled text document turned into an empty text block, which Anthropic rejects with a 400 ("text content blocks must be non-empty"). The block is now left out, and a title or context still goes through on its own

With drop_params on, document citations are dropped from every document and the text documents are converted, instead of failing the request with UnsupportedParamsError. Without drop_params the request still fails with the same error

Tool result content is read one level deep instead of recursively, since a tool result never holds another tool result

* fix(github_copilot): keep a turn of only empty text documents non-empty

Anthropic accepts a user turn that holds only an empty text document,
but once the Copilot adapter leaves that document out the turn has no
content and Copilot answers 400. Such a turn now gets the empty-content
placeholder text LiteLLM already sends on Anthropic routes, keeping the
last cache breakpoint.

* fix(github_copilot): pass request params through and keep cache breakpoints of dropped documents

The Copilot override handed the shared transformer a copy of the request
params, so max_tokens and the translated thinking no longer reached the
shared handler the way they do on every other Anthropic-shaped adapter.
It now passes the caller's dicts through, as the merge base did.

An untitled text document holding only whitespace is now left out like
an empty one, since Anthropic rejects a whitespace-only text block. A
left-out document's cache breakpoint moves to the block before it, the
block after it, or the tool result holding it, so the cached prefix stays
where the caller put it.

* fix(github_copilot): give a tool result left with only empty text documents the placeholder text

* fix(github_copilot): keep document citations under drop_params when converting shifts no index

---------

Co-authored-by: Gilad Katz <29776916+giladk1221@users.noreply.github.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-23 15:06:36 -08:00
..
_support feat(gateway): resolve Redis and the database in their own crates and hand them to routes as axum state (#52222) 2026-11-18 09:16:13 +09:00
audio_tests
base_sdk_tests fix(packaging): ship the license public key in the litellm-proxy sdist (#52970) 2026-11-19 23:18:32 +00:00
basic_proxy_startup_tests feat(docker)!: one shipped image and one entrypoint beside the Dockerfile (#43332) 2026-11-10 18:32:16 -08:00
benchmarks fix(proxy): count the request's tool_choice on the token count routes (#51133) 2026-11-14 07:53:27 -05:00
code_coverage_tests fix(proxy-extras): build the remaining request-log indexes in the migration job instead of in migrations (#49667) 2026-11-23 10:15:35 -08:00
documentation_tests chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
e2e test: update stale integration and e2e expectations for intended changes (#53940) 2026-11-23 14:27:20 -08:00
e2e_harness test(perf): gate large-body case on response time and CPU with a loose client p50 ceiling (#53155) 2026-11-21 03:47:17 +00:00
fixtures
harness_e2e
integration test: update stale integration and e2e expectations for intended changes (#53940) 2026-11-23 14:27:20 -08:00
rust-python-harness feat(messages): serve vertex ai claude messages on rust only (#52314) 2026-11-19 21:15:10 +00:00
test_litellm_rust fix(proxy): resolve admin oidc api_key references on batch cancel, fine-tuning listing, OCR, /v1/messages and cache prediction (#53678) 2026-11-23 10:11:10 -08:00
typing chore: move config and docs off the repo root (#50966) 2026-11-11 18:29:35 -08:00
unit fix(github_copilot): convert plain-text documents for native messages (#53554) 2026-11-23 15:06:36 -08:00
windows_tests ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
__init__.py
_fake_openai_endpoint_server.py
_flush_vcr_cache.py
_live_test_helpers.py
_master_key.py
_module_state.py ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
_openai_record_replay_proxy.py
_process_helpers.py
_vcr_conftest_common.py ci: remove CircleCI (#50950) 2026-11-11 15:38:27 -08:00
_vcr_redis_persister.py
_wait_helpers.py
_ws_vcr.py
AGENTS.md
capturing_transport.py
eval_swe_bench.py
fake_openai_endpoint.py
gettysburg.wav
large_text.py
openai_batch_completions.jsonl
pyrightconfig.json
README.MD
test_logging.conf
test_rust_python_harness.py
VCR_TESTING.md
white_100x100.png

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/unit

This folder can only run mock tests.