Commit Graph

35215 Commits

Author SHA1 Message Date
Cursor Agent ba8fed7fc8 refactor: extract _list_tools_for_single_server helper to fix PLR0915
Extract the single-server branch of list_tool_rest_api into a dedicated
helper function _list_tools_for_single_server. This reduces the statement
count in list_tool_rest_api from 57 to under 50, resolving the PLR0915
ruff lint error without needing a per-file-ignore.

The behavior is unchanged — all validation, IP-filtering, error handling,
and tool-fetching logic is preserved identically in the extracted helper.

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-12 20:06:10 +00:00
Cursor Agent e242356570 fix(ci): fix ruff lint errors and 9 failing unit tests on main
Lint fixes (check_code_and_doc_quality job):
- Remove unused variable reasoning_effort in gpt_5_transformation.py (F841)
- Remove unused timezone imports in mcp_server rest_endpoints.py and server.py (F401)
- Remove unused ProxyBaseLLMRequestProcessing import in realtime endpoints.py (F401)
- Add BaseRealtimeHTTPConfig to TYPE_CHECKING block in utils.py (F821)
- Add PLR0915 per-file-ignore for mcp_server/rest_endpoints.py in ruff.toml

Test fixes (litellm_mapped_tests_llms job):
- Gemini video cost tests: pass explicit model_info to video_generation_cost()
  instead of relying on gemini/veo-3.0-generate-preview being in model_prices JSON
- Anthropic max_tokens tests: mock get_max_tokens() to return expected values
  instead of depending on claude-3-5-sonnet-20241022 being in model_prices JSON
- Vertex AI pydantic obj test: update from removed gemini-1.5-pro to gemini-2.5-flash,
  update expected request body to use response_json_schema format
- Vertex AI/Bedrock file_content integration tests: update mocks to target
  base_llm_http_handler.retrieve_file_content (the new code path via
  ProviderConfigManager) instead of the old vertex_ai_files_instance/
  bedrock_files_instance paths

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-12 19:58:43 +00:00
Cesar Garcia 7ec78232b2 Merge pull request #23440 from BerriAI/litellm_oss_staging_03_11_2026
Litellm oss staging 03 11 2026
2026-03-12 16:24:14 -03:00
Chesars 690ad4c45b fix(openai): drop all reasoning_effort for gpt-5.4 + tools, including 'none'
OpenAI rejects any reasoning_effort (even 'none') with tools in
/v1/chat/completions for gpt-5.4. Update the guard to drop reasoning_effort
regardless of value. Add docs explaining the auto-drop behavior.
2026-03-12 16:22:40 -03:00
Chesars 17dbc61f39 fix(openai): align gpt-5.4 reasoning_effort drop with main
Remove dead routing condition (is_model_gpt_5_4_plus_model) that
prevented reasoning_effort from being dropped when tools are present.
The Responses API routing was never merged, so the guard was a no-op
that broke the drop logic introduced by 14b52b1318 on main.
2026-03-12 16:22:40 -03:00
Cesar Garcia ec763784e0 Merge branch 'main' into litellm_oss_staging_03_11_2026 2026-03-12 16:21:28 -03:00
Joe Reyna f2f843448e Merge pull request #23414 from joereyna/fix/pass-through-server-root-path
fix: strip SERVER_ROOT_PATH prefix before checking mapped pass-through routes
2026-03-12 11:57:13 -07:00
yuneng-jiang 779a231036 Merge pull request #23465 from BerriAI/ui_build_mar12
[Infra[ UI Build + Tests
2026-03-12 11:29:46 -07:00
yuneng-jiang d17d205963 chore: update Next.js build artifacts (2026-03-12 18:25 UTC, node v22.16.0) 2026-03-12 11:25:05 -07:00
yuneng-jiang c8ce098b65 fixing tests 2026-03-12 11:24:15 -07:00
yuneng-jiang 68b8b47d58 Merge pull request #23463 from BerriAI/ui_build_mar12
[Infra] Fixing UI Build
2026-03-12 10:54:00 -07:00
yuneng-jiang e38edb6190 fixing ui build 2026-03-12 10:51:49 -07:00
Chesars 0fc407cfdd ci: exclude enterprise/ from black --check in linting workflow
Contributors don't have local access to enterprise/ files,
so the check would always fail on unformatted enterprise code.
2026-03-12 14:27:00 -03:00
Cesar Garcia f79744cee2 Merge pull request #18648 from Chesars/fix-black-check-ci
fix: check Black formatting in CI instead of auto-formatting
2026-03-12 14:24:37 -03:00
Chesars 0fcc36c301 style: run black formatter on 52 non-enterprise files
Formats all files flagged by CI except 12 enterprise/ files
which require separate access to format.
2026-03-12 14:23:50 -03:00
Sameer Kankute 3c322a879f Merge pull request #23460 from BerriAI/litellm_add_webrtc_support
Improve doc for WebRTC
2026-03-12 22:46:23 +05:30
Sameer Kankute 8bbebb5d75 Improve doc for WebRTC 2026-03-12 22:45:36 +05:30
Sameer Kankute 5ccf1cf4fe Merge pull request #23459 from BerriAI/litellm_add_webrtc_support
Improve doc for WebRTC
2026-03-12 22:43:05 +05:30
Sameer Kankute cf1d330e63 Improve doc for WebRTC 2026-03-12 22:41:39 +05:30
Cesar Garcia e01d722803 Merge branch 'main' into litellm_oss_staging_03_11_2026 2026-03-12 13:53:14 -03:00
Sameer Kankute d507f840d3 Merge pull request #23432 from BerriAI/litellm_azure-model-router-show-actual-model
feat(azure_ai): show actual model used in Azure Model Router response
2026-03-12 22:18:50 +05:30
Sameer Kankute d1a99f571e Merge pull request #23446 from BerriAI/litellm_add_webrtc_support
[Feat] Add WebRTC support
2026-03-12 22:16:55 +05:30
Sameer Kankute 507bced04f Fix the live tester 2026-03-12 22:14:08 +05:30
Cesar Garcia 33457ab702 Merge pull request #23457 from Chesars/revert-revert-21601-model-cost-aliases
fix: restore commits lost by revert of PR #21601
2026-03-12 13:43:07 -03:00
Chesars 4e6e1d8de8 merge: resolve conflicts with upstream staging (bedrock + mcp tests)
Keep both sets of tests: upstream's OAuth2 token injection test and
our case-insensitive tool matching tests. Use upstream's version of
the bedrock output_config test (more comprehensive).
2026-03-12 13:40:16 -03:00
Chesars feed274aa3 Reapply "feat: add model_cost aliases expansion support"
This reverts commit 3d2df7e8b5.
2026-03-12 13:36:57 -03:00
michelligabriele 7c5e2e8389 fix(proxy): make async_post_call_response_headers_hook consistent across all endpoints (#22985)
* fix(proxy): make async_post_call_response_headers_hook consistent across all endpoints

The response headers hook had 5 gaps that prevented callbacks from
reliably extracting routing metadata across endpoint types:

1. Hook never fired for /audio/transcriptions (endpoint bypasses
   base_process_llm_request)
2. custom_llm_provider not accessible in hook data for any endpoint
3. custom_llm_provider not stamped in ResponsesAPIResponse._hidden_params
   (unlike chat completions)
4. model_info under inconsistent keys (metadata vs litellm_metadata)
5. request_headers always None at all call sites

This adds a litellm_call_info parameter to the hook that normalizes
routing metadata (custom_llm_provider, model_info, api_base, model_id)
regardless of endpoint type. Also stamps custom_llm_provider on
Responses API responses, adds the hook call to the transcription
handler, and passes request_headers at all call sites.

Supersedes PR #21385.

* fix(proxy): address review feedback — safer backwards compat and None guards

- Replace try/except TypeError with inspect.signature() check for
  litellm_call_info backwards compatibility. This avoids masking real
  TypeErrors inside callback implementations and prevents double
  invocation with inconsistent parameters.

- Use (data.get("key") or {}) instead of data.get("key", {}) to guard
  against keys that exist with an explicit None value, which would
  cause AttributeError on the subsequent .get() call.

* fix(proxy): cache inspect.signature result for callback compat check

Move the inspect.signature() call into a module-level helper with a
dict cache keyed by callback identity. Avoids repeated introspection
per request per callback in the hot path.

* fix(proxy): use class identity for signature cache key

Key the _CALLBACK_ACCEPTS_CALL_INFO cache by id(type(cb)) instead of
id(cb) to avoid stale entries from Python address reuse after GC.
All instances of the same callback class share the same method
signature, so class identity is both safer and more cache-efficient.
2026-03-12 08:51:00 -07:00
joereyna 1af7f11dae fix: extract normalize_route_for_root_path to deduplicate root-path stripping; fix mock target 2026-03-12 08:16:00 -07:00
joereyna 938452cc59 fix: extract normalize_route_for_root_path to deduplicate root-path stripping 2026-03-12 07:55:22 -07:00
Cesar Garcia 6bd7cd7573 Merge branch 'main' into litellm_oss_staging_03_11_2026 2026-03-12 10:43:08 -03:00
Sameer Kankute 291e6e1841 Merge pull request #23435 from BerriAI/litellm_vector-store-retrieve-list-update-delete
Add vector store retrieve list update delete
2026-03-12 19:08:39 +05:30
Sameer Kankute 4f5b6ae556 Merge pull request #23448 from BerriAI/litellm_cicd_1203126
Litellm cicd 1203126
2026-03-12 19:07:33 +05:30
Sameer Kankute b7cfcdd35d Add docs 2026-03-12 19:06:57 +05:30
Chesars fa68d69bcf fix: restore _get_effort_level and is_model_gpt_5_4_plus_model (PR #23151)
Independent fix (base: main) collaterally removed by PR #23276.
Restores:
- _get_effort_level() for extracting effort from string or dict
- is_model_gpt_5_4_plus_model() classmethod
- effective_effort usage in xhigh/tool-drop/sampling/temperature guards
- Azure: _get_effort_level import and usage for dict reasoning_effort
- Azure: gpt-5.4+ tool+reasoning drop logic
2026-03-12 10:28:27 -03:00
Chesars 9d1bcc7d37 Merge upstream/main into litellm_oss_staging_03_11_2026
Restore independent fixes from main that were collaterally removed
when PR #23276 (staging_03_10 → main) carried a revert commit:
- bedrock: restore output_config pop (PR #23240)
- redact_messages: restore dict handling for ModelResponse (PR #23235)
- model_checks: restore list() copies to avoid cache mutation (PR #23236)
- openapi_to_mcp_generator: restore relative URL handling (PR #23238)
- vertex_ai/gemini: restore _LITELLM_INTERNAL_EXTRA_BODY_KEYS check (PR #23131)
- openai types: restore extra finish reasons (PR #22138)
- completion_extras: restore usage transformation logic

Accept main for: model_prices JSONs, credential_endpoints,
team_endpoints, object_permission_utils, responses transformation.
2026-03-12 10:25:13 -03:00
Sameer Kankute bb451cfcb0 address greptile review feedback (greploop iteration 2)
- Thread api_version through HTTP handlers to Azure realtime endpoints
- Make expires_at optional in RealtimeClientSecretResponse
- Fix test token expiry times to be in the future
- Populate user_id and team_id in minimal_auth for spend tracking

Made-with: Cursor
2026-03-12 18:53:22 +05:30
Sameer Kankute f4103c51a6 address greptile review feedback (greploop iteration 1)
- Add api-version query param to Azure realtime URLs
- Remove Content-Type from Azure realtime_calls headers (httpx sets it)
- Add token expiry validation in proxy_realtime_calls endpoint
- Fix type annotations for upstream_resp

Made-with: Cursor
2026-03-12 18:40:37 +05:30
Sameer Kankute f5be79419c Fix test_claude_agent_sdk_streaming 2026-03-12 18:36:04 +05:30
Sameer Kankute f6238e781e Fix mypy 2026-03-12 18:35:17 +05:30
Sameer Kankute 982f3917c5 Fix test_standard_logging_payload 2026-03-12 18:35:01 +05:30
Sameer Kankute 15d873e204 Fix update deprecated model test 2026-03-12 18:34:20 +05:30
Sameer Kankute 374c35a6b7 Fix update deprecated model test 2026-03-12 18:34:15 +05:30
Sameer Kankute 7c70015a5f Fix mcp error 2026-03-12 18:33:58 +05:30
Sameer Kankute 18df137021 Fix mypy error 2026-03-12 18:33:40 +05:30
Sameer Kankute 0f91a4f9da Fix test_get_tools_for_single_server 2026-03-12 18:33:14 +05:30
Sameer Kankute 412a283569 Revert "fix(vertex): skip harmful schema transforms for Gemini 2.0+ tool parameters"
This reverts commit a9c3095cc5.
2026-03-12 18:26:11 +05:30
Sameer Kankute 72c98489d1 Revert "fix(vertex): shallow copy parameters before mutating in _build_vertex_schema_for_gemini_2"
This reverts commit 08d81f5d7c.
2026-03-12 18:26:11 +05:30
Chesars 47e9a0dcf0 Merge branch 'litellm_oss_staging_03_11_2026' of https://github.com/BerriAI/litellm into litellm_oss_staging_03_11_2026 2026-03-12 09:39:22 -03:00
Chesars 1be6b31e2f merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
Sameer Kankute 7aa5bd3ff3 Merge pull request #23429 from BerriAI/litellm_dev_03_10_2026_p1
Litellm dev 03 10 2026 p1
2026-03-12 18:04:48 +05:30