litellm/litellm
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
..
a2a_protocol refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
accounting feat(proxy): add app groups with shared budgets and usage (#53232) 2026-11-21 12:50:58 -08:00
anthropic_interface refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
assistants refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
batch_completion refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
batches 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
caching feat(caching): configure semantic cache params per key, user and team (#53905) 2026-11-23 13:55:45 -08:00
chat_completions fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00
cli refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
completion_extras refactor(types): replace Unknown with proven types in 62 files (#53647) 2026-11-23 18:17:56 +00:00
compression refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
containers refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
decisions fix(decisions): keep systemone confidence, extra fields and proxy cost on litellm_proxy calls (#53195) 2026-11-21 12:47:10 -08:00
deploy docs(terraform): clarify logging_callback ownership of unmanaged callbacks (#53895) 2026-11-23 11:54:56 -08:00
embeddings fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00
endpoints/speech/speech_to_completion_bridge refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
enterprise refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
evals refactor(types): replace Unknown with proven types in 68 files (#53642) 2026-11-23 07:11:32 +00:00
experimental_mcp_client refactor(mcp): drop the experimental label from the MCP server and client paths (#48513) 2026-10-27 17:47:50 +00:00
extraction
files refactor(types): replace Unknown with proven types in 62 files (#53647) 2026-11-23 18:17:56 +00:00
fine_tuning 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
google_genai fix(proxy): size the budget hold for Gemini native generateContent bodies (#53412) 2026-11-22 23:03:18 +00:00
harness refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
images refactor(types): replace Unknown with proven types in 62 files (#53647) 2026-11-23 18:17:56 +00:00
integrations fix(lens): accept a key in every header the gateway reads keys from on Lens routes (#53810) 2026-11-23 21:11:52 +00:00
interactions fix(proxy): bill an OpenAI pass-through background response to the key that created it (#53586) 2026-11-23 20:14:58 +00:00
litellm_core_utils feat(cost): price Claude token calls, budget holds and auth price checks in Rust (#52484) 2026-11-23 22:00:28 +00:00
llms fix(github_copilot): convert plain-text documents for native messages (#53554) 2026-11-23 15:06:36 -08:00
mcp_client fix(mcp): return an upstream -32042 URL elicitation error from /mcp as a JSON-RPC error (#52384) 2026-11-19 08:56:01 -08:00
messages feat(messages): serve bedrock claude_platform messages on rust only (#52681) 2026-11-19 14:34:02 -08:00
models feat(proxy)!: carry unused budget into the next period with a cap (#53309) 2026-11-22 02:05:03 -08:00
ocr fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00
packaging fix(packaging): ship the license public key in the litellm-proxy sdist (#52970) 2026-11-19 23:18:32 +00:00
passthrough refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
proxy feat(cost): price Claude token calls, budget holds and auth price checks in Rust (#52484) 2026-11-23 22:00:28 +00:00
proxy-extras fix(proxy): bill an OpenAI pass-through background response to the key that created it (#53586) 2026-11-23 20:14:58 +00:00
proxy_auth
rag 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
realtime_api feat(realtime)!: serve GPT-Live over WebRTC with sideband attach, and bill WebRTC calls from a proxy sideband (#53282) 2026-11-21 22:49:26 -08:00
redis perf(proxy): read only the needed team fields from the auth cache (#53909) 2026-11-23 12:53:14 -08:00
repositories fix(proxy): bill an OpenAI pass-through background response to the key that created it (#53586) 2026-11-23 20:14:58 +00:00
rerank_api docs(rerank): clarify callback cost accounting order (#53852) 2026-11-23 10:51:33 -08:00
responses feat(responses): store each bridged turn's path to the root so a fork replays only its ancestors (#49519) 2026-11-23 12:43:11 -08:00
router_rust feat(caching): configure semantic cache params per key, user and team (#53905) 2026-11-23 13:55:45 -08:00
router_strategy refactor(types): replace Unknown with proven types in 62 files (#53647) 2026-11-23 18:17:56 +00:00
router_utils refactor(types): replace Unknown with proven types in 62 files (#53647) 2026-11-23 18:17:56 +00:00
runtime fix(proxy): default uvicorn keep-alive to 95s so load balancers close idle connections first (#53879) 2026-11-23 11:23:10 -08:00
rust fix(rust): clear the rust-test and rust-wheel failures on main (#53922) 2026-11-23 22:55:09 +00:00
rust_bridge fix(rust): clear the rust-test and rust-wheel failures on main (#53922) 2026-11-23 22:55:09 +00:00
sandbox
scripts fix(db_scripts): spend logs runbooks repoint dependent views so the old table can be dropped (#50828) 2026-11-23 20:09:54 +00:00
search fix(tavily): price the search depth chosen automatically (#52564) 2026-11-18 13:04:12 -08:00
secret_managers refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
skills refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
systemone
telemetry fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00
text_completions fix: keep LiteLLM-internal params out of provider request bodies (#46083) 2026-11-16 22:20:05 -08:00
types feat(caching): configure semantic cache params per key, user and team (#53905) 2026-11-23 13:55:45 -08:00
ui fix(ui): move models refresh back to the tab row and space the budget percent (#53939) 2026-11-23 14:23:52 -08:00
vector_store_files
vector_stores fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00
videos refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
vscode-extension chore: move ui and vscode-extension under litellm and delete docs (#50992) 2026-11-12 04:19:57 +00:00
__init__.py feat(perplexity): add the Perplexity Orchestrator provider with cost tracking (#53583) 2026-11-23 07:17:47 +00:00
_internal_context.py refactor(redis): delete the Python RedisBatch now that every request op is native (#51383) 2026-11-13 03:22:28 +00:00
_lazy_imports.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
_lazy_imports_registry.py feat(harness): compare custom agents with supported harnesses (#53381) 2026-11-21 21:08:36 +00:00
_logging.py fix(logging): print a Rust log line's fields in plain Python logs (#53717) 2026-11-23 17:53:53 +09:00
_process_defaults.py
_redis.py refactor(types): replace Unknown with proven types in 62 files (#53647) 2026-11-23 18:17:56 +00:00
_redis_credential_provider.py
_service_logger.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
_uuid.py fix: support Python 3.15 (#48359) 2026-10-26 16:00:11 +00:00
_version.py
anthropic_beta_gated_fields.py fix(anthropic)!: send extra_body fields at the top level of the Messages request (#48373) 2026-11-20 06:52:56 -08:00
anthropic_beta_headers_config.json fix(bedrock): forward the compact-2026-09-04 compaction param on Invoke /v1/messages (#51223) 2026-11-11 15:10:32 -08:00
anthropic_beta_headers_manager.py fix(messages): load the anthropic beta map only when a filter has a beta to filter (#52188) 2026-11-16 20:03:08 -08:00
blog_posts.json chore(blog): refresh the bundled blog posts backup with the latest 50 posts from the docs RSS feed (#49971) 2026-11-03 23:41:15 +00:00
budget_manager.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
constants.py refactor(cost): price generic_cost_per_token with the native calculate (#52816) 2026-11-23 22:00:27 +00:00
cost.json
cost_calculator.py feat(cost): price Claude token calls, budget holds and auth price checks in Rust (#52484) 2026-11-23 22:00:28 +00:00
exceptions.py refactor(types): replace Unknown with proven types in 62 files (#53647) 2026-11-23 18:17:56 +00:00
guardrails.py Add guardrails.apply SDK helper (#49217) (#49469) 2026-10-31 23:37:45 +00:00
main.py fix(mcp): drop hosted MCP tool_choice under drop_params and honor drop_params in Bedrock batch rows (#53697) 2026-11-23 08:51:59 -08:00
model_prices_and_context_window_backup.json feat(cost-map): add together_ai/deepseek-ai/DeepSeek-V4.1-Flash-1017-fast at the Together models API rates (#53906) 2026-11-23 20:19:10 +00:00
policy_templates_backup.json
provider_endpoints_support_backup.json feat(perplexity): add the Perplexity Orchestrator provider with cost tracking (#53583) 2026-11-23 07:17:47 +00:00
py.typed
router.py refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
router_api.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
router_attempt.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
router_config.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
router_core.py chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
router_deprecated.py fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00
router_host.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
router_python_host.py feat(router): queue congested provider requests by priority (#51892) 2026-11-17 21:26:21 -08:00
scheduler.py refactor(types): replace Unknown with proven types in 245 files (#53774) 2026-11-23 10:05:26 -08:00
schema.prisma fix(proxy): bill an OpenAI pass-through background response to the key that created it (#53586) 2026-11-23 20:14:58 +00:00
setup_wizard.py
timeout.py
tool_loop.py fix(tool_choice): accept the Responses API's flat allowed_tools layout on chat completions (#50467) 2026-11-10 13:04:06 -08:00
utils.py 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