Commit Graph

37067 Commits

Author SHA1 Message Date
shivam 49ddb0e5ba style: apply Black formatting to Prometheus integration modules
Reformat prometheus logger, types, and metrics auth middleware so lint CI (black --check) passes.

Made-with: Cursor
2026-04-17 16:43:02 -07:00
shivam 733ccd6e09 fixed linting 2026-04-17 16:36:34 -07:00
shivam 7020b0a64b fix(proxy): replay ASGI receive after metrics auth to avoid /metrics hang 2026-04-17 13:32:05 -07:00
yuneng-jiang bdb4f396bb Merge pull request #25741 from joereyna/fix/test-server-root-path-timeout
fix(ci): increase test-server-root-path timeout to 30m
2026-04-14 19:54:23 -07:00
yuneng-jiang 3284dee734 Merge pull request #25737 from joereyna/fix/remove-missing-mcps-coverage-path
fix: remove non-existent litellm_mcps_tests_coverage from coverage combine
2026-04-14 19:54:13 -07:00
yuneng-jiang 50786007fc Merge pull request #25736 from BerriAI/docs_visual_guide_for_guardrail_fallbacks
docs update
2026-04-14 19:51:54 -07:00
yuneng-jiang ffc3a9736d Merge pull request #25739 from BerriAI/litellm_flakyBedrockGptOssToolCall
[Test] Replace flaky bedrock gpt-oss tool-call live test with request-body mock
2026-04-14 19:49:04 -07:00
joereyna ccbdaa9187 fix(ci): increase test-server-root-path timeout to 30m 2026-04-14 19:42:10 -07:00
Yuneng Jiang e2043e11f1 [Test] add request-body mock test for bedrock gpt-oss tool schema
Complements the stubbed-out live integration test by verifying the
outgoing Bedrock Converse request body for GPT-OSS is well-formed when
the caller supplies a tool schema with OpenAI-style metadata
($id, $schema, additionalProperties, strict):
- correct converse URL for bedrock/converse/openai.gpt-oss-20b-1:0
- toolConfig.tools[0].toolSpec has the expected name/description
- inputSchema.json keeps type/properties/required and strips fields
  Bedrock does not accept
2026-04-14 19:36:57 -07:00
Yuneng Jiang 8e44a02a22 [Test] stub flaky bedrock gpt-oss function-calling stream test
GPT-OSS on Bedrock intermittently emits truncated toolUse.input deltas
(e.g. accumulated args of '{"":"'), causing
test_function_calling_with_tool_response to hard-fail on json.loads.
The model flakiness is not a litellm regression: the same base test
passes for Anthropic in the same CI run, and the streaming delta path
at invoke_handler.py has not changed recently.

Follow the existing override pattern in TestBedrockGPTOSS
(test_prompt_caching, test_completion_cost, test_tool_call_no_arguments)
and stub the test to pass. The underlying bedrock converse streaming
tool-call path is already covered by Claude/Nova/Llama Converse suites
in test_bedrock_completion.py and test_bedrock_llama.py, so removing
the live GPT-OSS check loses no unique litellm-side signal.
2026-04-14 19:13:42 -07:00
Yuneng Jiang d6a69b9c81 [Test] mark bedrock gpt-oss function-calling stream test flaky
Bedrock GPT-OSS occasionally emits truncated toolUse.input deltas
(e.g. accumulated args of '{"":"'), which causes
test_function_calling_with_tool_response to hard-fail on json.loads.
Other overrides in TestBedrockGPTOSS already handle similar
model-side flakiness; apply retries=6 delay=5 scoped to this subclass
so other providers keep strict behavior.
2026-04-14 19:10:55 -07:00
joereyna a01cf44c35 fix: remove non-existent litellm_mcps_tests_coverage from coverage combine 2026-04-14 18:59:25 -07:00
shivam fd110cd5cf docs update 2026-04-14 18:33:42 -07:00
yuneng-jiang 5c1f7d99bf Merge pull request #25731 from BerriAI/docs_guardrail
fallbacks image
2026-04-14 18:13:12 -07:00
shivam 65ce89dc67 update 2026-04-14 18:02:41 -07:00
yuneng-jiang ec0953f7b0 Merge pull request #25728 from BerriAI/litellm_fix_together_ai_test_model
[Fix] Test - Together AI: replace deprecated Mixtral with serverless Qwen3.5-9B
2026-04-14 18:01:56 -07:00
shivam 19629004f5 fallbacks image 2026-04-14 17:58:11 -07:00
Yuneng Jiang a9c6156137 [Fix] Test - Together AI: replace deprecated Mixtral with serverless Qwen3.5-9B
Mixtral-8x7B-Instruct-v0.1 is no longer on Together AI's serverless tier
and now requires a dedicated endpoint, causing multiple tests to fail in CI:

  - test_together_ai.py::TestTogetherAI::test_empty_tools
  - test_completion.py::test_completion_together_ai_stream
  - test_completion.py::test_customprompt_together_ai
  - test_completion.py::test_completion_custom_provider_model_name
  - test_text_completion.py::test_async_text_completion_together_ai

Qwen/Qwen3.5-9B is currently serverless on Together AI and supports
function calling, satisfying BaseLLMChatTest capability requirements.
2026-04-14 17:43:35 -07:00
yuneng-jiang 2af0768ab9 Merge pull request #25727 from BerriAI/litellm_removeChatUiSwaggerLink
[Refactor] Remove Chat UI link from Swagger docs message
2026-04-14 17:36:52 -07:00
yuneng-jiang bb91f3ace9 Merge pull request #25726 from BerriAI/docs_yj_apr14
[Docs] Regenerate v1.83.3-stable release notes from previous stable
2026-04-14 17:29:34 -07:00
Yuneng Jiang 58ce769092 Remove Chat UI link from Swagger docs message 2026-04-14 17:27:25 -07:00
Yuneng Jiang 05ad48236f [Docs] Regenerate v1.83.3-stable release notes from v1.82.3-stable baseline
The previous v1.83.3 changelog was generated against v1.83.0-nightly and
missed ~3 weeks of work. This regenerates it against the previous stable
release and restructures the LLM API Endpoints section to group by API
type (Responses, Batch, Count Tokens, Video Generation, Pass-Through,
etc.) matching the convention used in v1.82.3, v1.82.0, and v1.81.14.
Adds ~25 previously uncited PRs, cross-section duplications for
cross-cutting changes, and a verified first-time-contributors list.
2026-04-14 17:19:42 -07:00
ryan-crabbe-berri 6d2b7b76ad Merge pull request #25721 from BerriAI/litellm_fix-invite-user-default-role
fix: default invite user modal global role to least-privilege
2026-04-14 16:34:04 -07:00
yuneng-jiang 260d51ad67 Merge pull request #25723 from BerriAI/litellm_release_notes_v1_83_3_v1_83_7rc1
[Docs] Add release notes for v1.83.3-stable and v1.83.7.rc.1
2026-04-14 16:32:17 -07:00
Ryan Crabbe 3aae15f5d8 [Docs] Use GitHub avatar for Ryan Crabbe in release notes
Replace the expiring LinkedIn CDN image URL with a stable GitHub
avatar URL for v1.83.3 and v1.83.7.rc.1 release notes.
2026-04-14 16:22:07 -07:00
Yuneng Jiang 966be2982a [Docs] Add missed content PRs to v1.83.7.rc.1 and update runbook
- Add 8 content PRs that merged directly to the release branch outside the listed staging PRs: #23769 (Ramp callback), #25252 (JWT OAuth2 override), #25254 (AWS GovCloud mode), #25258 (batch-limit cleanup), #25334 (router custom_llm_provider), #25345 (Triton embeddings), #25347 (tag-based routing), #25358 (Baseten pricing attribution)
- Add @kedarthakkar to new contributors (first-ever PR via #23769)
- Update RELEASE_NOTES_GENERATION_INSTRUCTIONS: require walking git log range between release tags in addition to staging PRs, and verify new-contributor status per author rather than trusting the GH release body floor
2026-04-14 16:13:09 -07:00
Yuneng Jiang 4a1da629fa [Fix] Correct pip install versions for v1.83.3-stable and v1.83.7.rc.1 docs
PyPI publishes 1.83.3 and 1.83.7 (no .post1 / rc1 suffixes) — align the pip install commands with the actual published versions.
2026-04-14 16:00:27 -07:00
Yuneng Jiang 8eec2c69b7 [Docs] Add release notes for v1.83.3-stable and v1.83.7.rc.1
- Retitle existing v1.83.3 preview file to v1.83.3-stable (same commit)
- Add new v1.83.7.rc.1 preview release notes
- Update RELEASE_NOTES_GENERATION_INSTRUCTIONS runbook with guidance on resolving staging PRs to their underlying commits
2026-04-14 15:58:13 -07:00
Ryan Crabbe a428ae7599 fix: default invite user modal global role to least-privilege
Pre-select "Internal User Viewer" in the Global Proxy Role dropdown
on both the standalone and embedded Invite User forms so admins don't
have to remember to pick a role, and the default lands on the least
privileged option rather than silently posting an undefined role.
2026-04-14 15:45:35 -07:00
yuneng-jiang 7b36cfc0de Merge pull request #25719 from BerriAI/litellm_fix-ui-unit-tests-get-cookie
test(ui): add getCookie to cookieUtils mock in user_dashboard test
2026-04-14 15:32:13 -07:00
Ryan Crabbe bdaaa5c187 test(ui): add getCookie to cookieUtils mock in user_dashboard test
user_dashboard.tsx imports getCookie from @/utils/cookieUtils, but the
vi.mock factory in user_dashboard.test.tsx only exports clearTokenCookies.
Vitest throws `No "getCookie" export is defined on the "@/utils/cookieUtils"
mock`, breaking all three beforeunload-listener tests.

Add getCookie to the mock factory so it matches the current imports.
2026-04-14 15:18:10 -07:00
ryan-crabbe-berri 43efe76f17 Merge pull request #25716 from BerriAI/litellm_fix-logs-team-filter-state-bleed
fix: isolate logs team filter dropdown from root teams state bleed
2026-04-14 14:44:37 -07:00
ryan-crabbe-berri ec4ce1cc4a Merge pull request #25700 from BerriAI/litellm_fix-guardrail-bool-select-rendering
fix(ui): pre-select backend default for boolean guardrail provider fields
2026-04-14 14:31:28 -07:00
Ryan Crabbe 1beb8037d1 fix: isolate logs team filter dropdown from root teams state bleed
The Logs view's Team ID filter dropdown was reading `allTeams` from the
root `teams` state in page.tsx, which the Teams page search overwrites
with its filtered subset. Applying a team search on the Teams page made
filtered-out teams disappear from the Logs filter dropdown.

Swap the Team ID filter to use the existing `TeamDropdown` component via
a small `FilterTeamDropdown` wrapper that adapts it to the filter slot's
`FilterOptionCustomComponentProps` contract. The dropdown now drives its
own `useInfiniteTeams` query against `/v2/team/list` with server-side
search and an isolated react-query cache, unreachable from root state.

Rename the now-unused `hookAllTeams` destructure to `allTeams` so the
`KeyInfoView` passthrough receives the hook's unpolluted fetch instead
of the polluted prop, and drop the dead `allTeams` prop from
`SpendLogsTable` and both of its call sites.
2026-04-14 14:28:53 -07:00
ishaan-berri 0e43050a01 Merge pull request #25650 from BerriAI/litellm_dev_04_13_2026_p1
feat: add litellm.compress() — BM25-based prompt compression with ret…
2026-04-14 12:24:47 -07:00
Tim db94b4d55c fix(cost-map): add us-south1 to vertex qwen3-235b-a22b-instruct-2507-maas (#25382) 2026-04-14 11:59:36 -07:00
Sameer Kankute 1a9a31e4a2 Merge pull request #25665 from BerriAI/litellm_oss_staging_04_13_2026_p1
litellm oss staging 04/13/2026
2026-04-14 23:50:08 +05:30
Sameer Kankute dec630b365 Fix mypy issues 2026-04-14 23:37:50 +05:30
LeVDuan 085e70cd3e refactor: extract search tool conflict resolution into _resolve_search_tool_conflict method 2026-04-14 23:37:50 +05:30
LeVDuan cacc3b326d fix: skip dropping search tools when server-side tool invocations enabled (Gemini 3+) 2026-04-14 23:37:49 +05:30
LeVDuan 1e79ad69ab docs: add comment explaining why non-search tools are preserved 2026-04-14 23:37:49 +05:30
LeVDuan 212b249e38 fix(vertex_ai): drop search tools when mixed with function declarations (#23337)
Vertex AI rejects requests containing both search tools (googleSearch,
enterpriseWebSearch, urlContext) and function declarations with error:
'Multiple tools are supported only when they are all search tools.'

When _merge_tools_from_deployment() combines deployment-level search
tools with user-request function tools (e.g. via MCP), the mixed tool
list causes a 400 error. This fix detects the conflict in _map_function()
and drops search tools, keeping function declarations.

Non-search tools like code_execution and computerUse are preserved.

Fixes #23337
2026-04-14 23:37:49 +05:30
Emerson Gomes 924418aeea fix: prune expired in-memory cache heap entries (#25664) 2026-04-14 23:37:49 +05:30
Emerson Gomes a302b53980 fix: drain datadog batches safely (#25663)
* fix: drain datadog batches safely

* fix: preserve datadog batches on 413

* fix: import time in datadog flush queue

* test: cover datadog batching edge cases

* fix: only stamp successful datadog flushes

* test: use sync mock for datadog payload builder
2026-04-14 23:37:49 +05:30
Jonas Neubert e724e5e07d add NO_OPENAPI env var to disable /openapi.json endpoint (#25547) 2026-04-14 23:37:49 +05:30
hatim-ez 17bfa420e4 fix(router): discard oldest entry when trimming latency list in lowest_latency strategy (#25548)
* fix(router): discard oldest entry when trimming latency list in lowest_latency strategy

The lowest_latency routing strategy keeps a rolling window of the most
recent latency and time-to-first-token measurements per deployment. When
the window is full, the strategy was discarding the *newest* value
instead of the oldest, because the trim used
`[: max_latency_list_size - 1]` (keeping indices 0..N-2) rather than
`[1:]` (dropping index 0 and keeping indices 1..N-1).

Since new values are appended at the end, the bug meant the most recent
measurement was always dropped once the list reached capacity. The
routing decisions then relied on stale data (including any early-spike
values that never aged out), and timeout penalties written via
`async_log_failure_event` were silently discarded as well.

Fix the slice in all five call sites (sync + async log_success_event for
both latency and time_to_first_token, and async_log_failure_event for
the timeout penalty) and add regression tests covering each path.

* test(router): cover async TTFT trim path in lowest_latency regression tests

Adds test_ttft_list_trimming_discards_oldest_entry_async, an async
counterpart to test_ttft_list_trimming_discards_oldest_entry that drives
async_log_success_event with a ModelResponse and completion_start_time so
the async time_to_first_token trim branch is actually exercised.

Previously no test touched that code path: the sync TTFT test used
log_success_event, and the async latency test passed a plain dict
response_obj without stream/completion_start_time, so TTFT was never
computed and the async trim was unreached. Verified load-bearing by
reverting only the async TTFT slice — the new test fails and all others
pass.

* format
2026-04-14 23:37:49 +05:30
Ashton Sidhu 6343148c95 Hiddenlayer Integration: Add V2 Integration (#22708)
* Serialize error message to a string; only scan last message

* Update litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Add v2 of hiddenlayer guardrail implementation

* Update litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Fix potential header issue

* linting

* Add image support

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-04-14 23:37:49 +05:30
Daan 1d45cfd1fc fix(proxy) - #25506 Team members added before team_member_budget is configured have no budget enforcement (#25557)
* fix #25506

* address greptile review feedback

* [Test] UI - Models: Add E2E tests for Add Model flow

Add E2E tests covering:
- Test connection with bad credentials shows failure modal
- Adding a specific model and verifying it appears in All Models table
- Adding a wildcard route and verifying it appears in All Models table
- Verifying model dropdown shows provider-specific models (existing test updated)

Added data-testid attributes to UI components to support stable test selectors.

Tests verified passing 3/3 consecutive runs with zero flakiness.

* address greptile review feedback (greploop iteration 1)

Add cleanup helper to delete models created during tests, preventing
stale data accumulation across repeated test runs.

* fix CI: replace data-testid selectors with text/role-based selectors

The data-testid attributes added to React components are not present
in the CI-built UI output. Switch to using getByRole and getByText
selectors which work with the rendered DOM regardless of build cache.

* remove unnecessary cleanup helper

The database is freshly seeded on every test run via seed.sql,
so per-test cleanup is not needed.

---------

Co-authored-by: Yuneng Jiang <yuneng@berri.ai>
Co-authored-by: Krrish Dholakia <krrish+github@berri.ai>
2026-04-14 23:37:49 +05:30
Kris Yang 15245a5eb7 fix: emit input_json_delta for tool args bundled in first streaming chunk (#25533)
* fix: emit input_json_delta for tool args bundled in first streaming chunk

Some providers (xAI, Gemini) include tool_call function arguments in the
same streaming chunk as the function name/id. The AnthropicStreamWrapper
was discarding the trigger chunk entirely when starting a new content
block, which silently dropped the input_json_delta carrying tool
arguments. This caused tool_use blocks to arrive with empty input {}.

Now queue the processed_chunk after content_block_start when it carries
non-empty input_json_delta data. Backward compatible: providers that send
empty arguments in the first chunk (OpenAI-style) are unaffected since
the condition checks for truthy partial_json.

* test: add tests for input_json_delta emission on bundled tool args

Covers the fix for providers (xAI, Gemini) that bundle tool_call
arguments in the same streaming chunk as the function name/id.
Verifies the AnthropicStreamWrapper emits input_json_delta after
content_block_start, and that empty-arg chunks (OpenAI-style) are
unaffected.

* style: apply Black formatting to streaming_iterator.py

* fix: mirror input_json_delta fix to sync __next__ and add sync tests

* test: make no_extra_delta tests assert explicitly instead of passing silently
2026-04-14 23:37:49 +05:30
lucassz dd93d2698b fix(gemini): assign correct indices in batch embedding response (#25656)
### Background

The Gemini batchEmbedContents response handler hardcoded `index=0` for
every embedding in the response. Any consumer relying on the OpenAI-format
`index` field to match embeddings back to inputs would silently get wrong
associations.

### Changes

Use `enumerate` in `process_response` so each embedding gets its
positional index instead of 0.

### Test Plan

Added unit test asserting sequential indices and correct vector ordering
for a 3-element batch response.
2026-04-14 23:37:49 +05:30