Commit Graph

666 Commits

Author SHA1 Message Date
Krish Dholakia e4e10aa4ed Litellm dev 07 21 2025 p1 (#12848)
* fix(main.py): fix async retryer

Fixes https://github.com/BerriAI/litellm/issues/12830

* fix(forward_clientside_headers_by_model_group.py): filter out 'content-type' from forwardable headers

clientside content-type != proxy content type, can cause requests to hang

* test(tests/): update tests
2025-07-21 22:09:39 -07:00
Ishaan Jaff 49d40a1c3d test_router_provider_wildcard_routing 2025-07-21 21:33:40 -07:00
Tomáš Dvořák 270e3d75db fix(watsonx): use correct parameter name for tool choice (#9980)
Closes BerriAI/litellm#9979
2025-07-21 19:01:10 -07:00
Ishaan Jaff 4a7b9dee5f test fix - anthropic deprecated claude 2 2025-07-21 18:22:39 -07:00
Ishaan Jaff 7bd5ce595d test_provider_budgets_e2e_test_expect_to_fail 2025-07-19 16:00:25 -07:00
Ishaan Jaff 48dede9367 test_redis_proxy_batch_redis_get_cache 2025-07-19 15:58:25 -07:00
Krish Dholakia ab09d0621d Litellm gemini grounding metadata stream (#12673)
* fix(prompt_templates/factory.py): handle anthropic cache control on individual tool results

Fixes issue where cache control on individual tool result was being ignored

* test(test_vertex_And_google_ai_studio_gemini.py): initial unit test covering translation for grounding metadata on streaming chunk

* fix(vertex_and_google_ai_studio.py): ensure grounding metadata is preserved on streaming

Closes https://github.com/BerriAI/litellm/issues/10237

* fix(core_helpers.py): include usage in expected openai keys
2025-07-19 11:52:12 -07:00
Jugal D. Bhatt be60d12ff7 [LLM Translation - Redis] fix: redis caching for embedding response models (#12750)
* fix: redis caching for embedding responses

* add helper

* add mypy fixes

* lint fix

* review changes

* remove file

* fix ruff

* add if check

* add if check
2025-07-18 16:31:10 -07:00
Jugal D. Bhatt a46b9d376f [Prometheus] Move Prometheus to enterprise folder (#12659)
* fix tools fetch for keys

* add promethues to enterprise

* remove old prom

* remove old prom

* fix tests

* safe imports

* add if

* fix enterprise test

* rename imports

* added label import

* added label import

* move tests to enterprise

* fix tests

* add log

* build: update versions

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@gmail.com>
2025-07-18 11:54:47 -07:00
Ishaan Jaff d9943f9812 fix cohere InternalServerError error mapping 2025-07-16 16:13:34 -07:00
Krrish Dholakia 8a1a90bc7a test: update test 2025-07-16 10:28:08 -07:00
Krrish Dholakia 9cac629ca6 test: update test 2025-07-16 09:13:16 -07:00
Krrish Dholakia 85fe1d35e1 test: update test, remove old gemini models 2025-07-15 22:31:49 -07:00
Ishaan Jaff 84261f3ac8 test_create_delete_assistants 2025-07-15 21:35:25 -07:00
Ishaan Jaff f0e87d4eb0 test test_redis_caching_multiple_namespaces (#12552) 2025-07-12 12:06:16 -07:00
Ishaan Jaff 7eb1a68854 fix test_qdrant_semantic_cache_acompletion 2025-07-11 22:07:19 -07:00
Ishaan Jaff 7ac187b269 test_pre_call_hook_team_rpm_limits 2025-07-11 15:52:21 -07:00
Ishaan Jaff 47ba271d58 test_http_parsing_utils.py 2025-07-10 18:20:41 -07:00
Krish Dholakia bda9eecd45 Litellm dev 07 05 2025 p3 (#12349)
* refactor(aim.py): refactor to support adding aim guardrails on UI

* fix(base.py): add ui_friendly_name to config model

* feat(ui/): support loading new guardrails from backend api call

removes need to onboard each guardrail to ui

* fix: don't show optional params if not set and don't show ui_friendly_name (internal param0

* fix(ui/add_guardrail_form.tsx): ensure dynamic provider value is used

* fix(ui/): just one-time update the provider map dictionary

* fix(ui/): show masked api base / api key on guardrail update

* refactor(aporia_ai/): refactor to show on UI

* feat(aporia_ai/): add aporia ai guardrail to UI

* refactor(guardrails_ai/): refactor to add via UI

* refactor(lasso.py): refactor to enable adding lasso guardrails via UI

* feat(pangea.py): add pangea guardrail on UI

* feat(panw): add panw prisma airs through UI

* test: update tests

* fix: fix ruff linting error

* test: update tests

* fix: add missing docs

* fix: fix guardrail init

* fix: suppress linting errors

* fix(proxy_server.py): fix linting error
2025-07-05 18:44:00 -07:00
Krish Dholakia 380eb31103 feat(vertex_ai/): add new deepseek-ai api service (#12312)
* feat(vertex_ai/): add new deepseek-ai api service

Closes https://github.com/BerriAI/litellm/issues/12192

* test: cleanup test
2025-07-05 10:38:37 -07:00
Ishaan Jaff 19e26a5c60 test_default_api_base 2025-07-04 18:26:54 -07:00
Ishaan Jaff 59f3771799 test_text_completion_stream - hf 2025-07-03 16:00:51 -07:00
Ishaan Jaff 437f4765b4 test_completion_mistral_api_mistral_large_function_call_with_streaming 2025-07-03 14:58:28 -07:00
Krish Dholakia c0319d0d01 Litellm dev fix gemini web search tracking (#12288)
* feat(stream_chunk_builder_utils.py): correctly return web_search_requests on stream chunk builder

* fix(types/utils.py): handle prompttokendetails

* fix(stream_chunk_builder_utils.py): fix ruff check error

* test: try-except rate limit error

* fix: fix import
2025-07-03 12:27:14 -07:00
Ishaan Jaff 75bb22a868 fix huggingface/deepseek-ai/DeepSeek-R1 2025-07-03 12:13:51 -07:00
Ishaan Jaff 5630147e80 Revert "Revert "fix tests (#12286)""
This reverts commit 12f157513b.
2025-07-03 12:08:27 -07:00
Ishaan Jaff 12f157513b Revert "fix tests (#12286)"
This reverts commit 99ce3a24cc.
2025-07-03 12:04:23 -07:00
célina 99ce3a24cc fix tests (#12286) 2025-07-03 10:57:19 -07:00
Krrish Dholakia a198d4a39f test: change mistral model
service tier exceeded
2025-07-02 21:11:02 -07:00
Ishaan Jaff 6b623f9c98 test whitelisted models 2025-06-28 14:46:16 -07:00
Ishaan Jaff 041db0268c [Bug fix] Router - handle cooldown_time = 0 for deployments (#12108)
* fix get cooldown time

* fixes for _should_run_cooldown_logic

* test_cooldown_time_zero_uses_zero_not_default

* Update litellm/router_utils/cooldown_cache.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update litellm/router_utils/cooldown_handlers.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-27 17:50:35 -07:00
Krish Dholakia 7f8b2579a2 Minor Fixes (#11868)
* fix(litellm_pre_call_utils.py): add user agent tags to spend logs in standard logging payload logic

avoid clash when tag based routing is enabled

* test: remove redundant test

* test: rename oidc test to run earlier

quicker debuging

* fix(azure.py): return more detailed error message

* fix(azure/common_utils.py): use default scope, if scope is none

fixes oidc test

* fix: always default to cognitiveservices.azure.com

* test: update test
2025-06-18 14:12:59 -07:00
Krish Dholakia 0319adbf5d feat(speech/): working gemini tts support via openai's /v1/speech endpoint (#11832)
* feat(speech/): working gemini tts support via openai's `/v1/speech` endpoint

Enables calling gemini models via `/v1/speech`

* feat(speech_to_completion_bridge/): voice param support

enables passing voice param to gemini models

* fix: fix ruff checks

* fix: fix checks
2025-06-18 10:36:25 -07:00
Ishaan Jaff 355e6118d8 def test_text_completion_stream(): 2025-06-14 16:46:09 -07:00
Ishaan Jaff 5a051cb264 test_async_embedding_azure_caching - flaky test 2025-06-14 13:55:29 -07:00
Ishaan Jaff e3094c2249 set flaky tests as flaky 2025-06-14 13:51:52 -07:00
Krrish Dholakia 31a73be03f fix(litellm_logging.py): skip should_run_logging check on streaming 2025-06-13 21:19:24 -07:00
Ishaan Jaff 5b451bf483 test_openai_azure_embedding_simple 2025-06-13 19:00:25 -07:00
Ishaan Jaff 7947139913 [Feat] MCP expose streamable https endpoint for LiteLLM Proxy (#11645)
* feat - add https mcp support

* fixes for MCP http integration

* fix code QA

* bump mcp dep

* test_mcp_server_manager_https_server

* test mcp server https

* fix linting error

* bump mcp in poetry

* fix import streamablehttp_client

* fix streamablehttp_client

* fix streamablehttp_client

* add streamablehttp_client

* add simple https server

* working mounted app

* working HTTPS mcp streamable

* fix code QA check

* feat: add MCP Server

* fix - init just as fastapi app

* add LITELLM_MCP_SERVER_DESCRIPTION

* fix importing / init litellm app

* Update litellm/proxy/_experimental/mcp_server/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update litellm/proxy/_experimental/mcp_server/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fixes based on review + code check

* fix linting

* test_streamable_http_mcp_handler_mock

* fix python 3.13 install

* fix deps test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-12 16:32:04 -07:00
Thiago Salvatore fab24fae1a fix: Do not add default model on tag based-routing when valid tag (#11454)
* Do not add default when valid tagged model

* Use default models when no tag matches

* Add unit tests
2025-06-12 13:18:42 -07:00
Krrish Dholakia e46ef9d642 test: update test with new kwargs 2025-06-11 22:19:17 -07:00
Ishaan Jaff 91010cda8f [Bug Fix] Add audio/ogg mapping for Audio MIME types (#11635)
* Add audio/ogg mapping

* test_vertex_ai_gemini_audio_ogg

* test_vertex_ai_gemini_audio_ogg
2025-06-11 14:19:53 -07:00
Krrish Dholakia ec52600f98 test: handle fireworks ai instability 2025-06-11 10:09:28 -07:00
Krish Dholakia c569056ea8 Show remaining users on UI (#11568)
* docs(deploy.md): move docker recommendation to `main-stable`

* feat(enterprise/internal_user_endpoints.py): expose endpoint for checking available premium users

* feat(usage_indictor.tsx): add new element to help track remaining premium users

* feat(usage_indicator.tsx): show premium user remaining usage

allows users with user caps to know how much is left

* fix(vertex_and_google_ai_studio_gemini.py): bubble up stream is not finished, even if stop reason is given

prevents early completion of stream

Closes https://github.com/BerriAI/litellm/issues/11549

* fix(streaming_handler.py): respect is_finished = False in hidden params

internal logic for preventing ending stream early

* fix(litellm_license.py): add function to check if user is over limit

* fix(internal_user_endpoints.py): add function to check if user is over limit

* refactor: move test

* docs(customer_endpoints.py): document new param
2025-06-09 22:04:45 -07:00
Laurien 0c50f8bcc9 Update enduser spend and budget reset date based on budget duration (#8460) 2025-06-08 08:39:14 -07:00
Krish Dholakia 8dd8615a54 Ensure consistent 'created' across all chunks + set tool call id for ollama streaming calls (#11528)
* fix(streaming_handler.py): maintain same 'created' across all chunks

Fixes https://github.com/BerriAI/litellm/issues/11437

* test: add unit test to ensure created is always the same across all chunks

* fix(types/utils.py): set a tool call id, if missing in delta tool call

Ensures stream chunk builder can reconstruct tool calls correctly

Fixes https://github.com/BerriAI/litellm/issues/11262

* fix(responses/transformation.py): support passing mcp server tool call to anthropic

allows switching between openai and anthropic for mcp tool calling

* fix(ollama/chat/transformation.py): set tool call id's when missing
2025-06-07 20:50:07 -07:00
Krish Dholakia c42740a4b9 Simplify experimental multi-instance rate limiter - more accurate (#11424)
* refactor: comment out circuit breaker

causes incorrect rate limiting in high traffic

* fix(base_routing_strategy.py): don't reset value if redis val is lower than current in-memory value

Fixes issue where redis might be trailing in-memory value

* fix(parallel_request_limiter_v2.py): if in-memory higher than redis, don't reset value; add previous slot keys to redis increment to correctly 'get' them

* fix(parallel_request_limiter_v3.py): v3 implementation of parallel request limiter

does not use background redis syncing - increments redis in call

 simplify rate limiting logic, to improve accuracy

* fix: fix ruff errors

* fix(parallel_request_limiter_v3.py): don't decrement limit on post call success - causes double decrements

* fix(parallel_request_limiter_v3.py): working accurate multi-instance logic

ensured just 100 requests allowed on 100 users, 10 ramp up, 100 rpm limit key, 2 instances

* fix(parallel_request_limiter_v3.py): working accurate rate limiting with time window resets

allows rate limiting to work across multiple windows

* test: add unit tests for v3 rate limiter

* fix(parallel_request_limiter_v3.py): return window value into in-memory cache

allows in-memory cache checks to be used correctly

* refactor(parallel_request_limiter_v3.py): refactor rate limiting to work for multiple window/counter key pairs

enables using for user/team/model rate limiting

* feat(parallel_request_limiter_v3.py): working rate limiting, across key/user/team/end-user

* fix(parallel_request_limiter_v3.py): add model specific rate limiting

* fix(parallel_request_limiter_v3.py): ignore if no rate limits set

skip unecessary rate limit checks - if no limits set

* fix(parallel_request_limiter_v3.py): initial commit bringing token rate limits back

* fix(parallel_request_limiter_v3.py): increment by value in list + update assertions to handle tokens + max parallel requests

* test(parallel_request_limiter_v3.py): more testing

* fix(parallel_request_limiter.py): working in-memory cache limiter

* fix(redis_cache.py): ignore linting error - use safe hasattr

* fix(parallel_request_limiter_v3.py): fix linting error

* refactor: remove redundant parallel_Request_limiter_v2.py

old / inaccurate implementation

* test: update tests

* style: cleanup

* test: update test

* docs(config_settings.md): document new env var

* test(test_base_routing_strategy.py): update test
2025-06-07 11:10:55 -07:00
Ishaan Jaff bc835c6044 test_lm_studio_completion 2025-06-06 20:41:00 -07:00
Cole McIntosh e191e72746 Fix: Respect user_header_name property for budget selection and user identification (#11419)
* Refactor get_end_user_id_from_request_body to support user ID retrieval from custom headers and multiple request body formats. Enhance tests to cover various scenarios including header precedence and fallback mechanisms.

* Refactor get_end_user_id_from_request_body function to accept request_body as the first parameter, improving clarity and flexibility. Update tests for compatibility and add new cases to ensure correct functionality across various request body formats.

* Update _user_api_key_auth_builder and user_api_key_auth to pass request object to get_end_user_id_from_request_body, enhancing user ID retrieval from request data.

* refactor(auth_utils.py): update get_end_user_id_from_request_body to accept request_headers instead of request, and adjust related function calls in user_api_key_auth and tests

* refactor(tests): update mock request handling in LLM pass-through endpoint tests

- Replaced the Request object with a Mock for better flexibility in testing.
- Enhanced mock setup to include user API key handling and virtual key retrieval.
- Updated test calls to reflect changes in mock request structure and added necessary patches for new dependencies.

* refactor(vertex_and_google_ai_studio_gemini.py): remove redundant variable declaration for url_context_metadata, linting error
2025-06-06 14:21:02 -07:00
Cole McIntosh 1ceb9f9621 Merge pull request #11455 from colesmcintosh/429-fireworks-mapping
Fix Fireworks AI rate limit exception mapping - detect "rate limit" text in error messages
2025-06-06 15:06:15 -06:00