Commit Graph
2310 Commits
Author SHA1 Message Date
Krish DholakiaandGitHub 53f6514f12 Support Anthropic web search tool + Add more google finish reason mapping (#10785)
* fix(vertex_and_google_ai_studio_gemini.py): handle additional google finish reasons

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

* test: add more unit tests

* fix(anthropic/chat/transformation.py): support anthropic web search

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

* fix(anthropic/chat/transformation.py): add anthropic web search 'max uses' param support

* docs(anthropic.md): add doc for web search tool calling

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

* build(model_prices_and_context_window.json): add search tool pricing for anthropic

* fix: suppress linting error

* test: update tests

* fix: fix ruff check
2025-05-12 22:45:51 -07:00
Krrish Dholakia fea3966d8e refactor: rename tests 2025-05-12 22:04:55 -07:00
d37cc63250 Add new model provider Novita AI (#7582) (#9527)
* Add new model provider Novita AI (#7582)

* feat: add new model provider Novita AI

* feat: use deepseek r1 model for examples in Novita AI docs

* fix: fix tests

* fix: fix tests for novita

* fix: fix novita transformation

* ci: fix ci yaml

* fix: fix novita transformation and test (#10056)

---------

Co-authored-by: Jason <ggbbddjm@gmail.com>
2025-05-12 21:49:30 -07:00
643d2a8ccb [Feat] Option to force/always use the litellm proxy (#10559) (#10633) (#10773)
* [Feat] Option to force/always use the litellm proxy (#10559) (#10633)

* fix: add use_litellm_proxy

* fix: update LiteLLMProxyChatConfig

* fix get llm provider logic

* tests get llm provider logic

* add dynamic use_litellm_proxy

* docs forcsing litellm proxy usage

* fix: _should_use_litellm_proxy_by_default

* fixes: get_custom_llm_provider

---------

Co-authored-by: Antoine Legrand <2t.antoine@gmail.com>
2025-05-12 20:22:54 -07:00
Ishaan JaffandGitHub eeb27d70c1 [Fix] Allow using dynamic aws_region with /messages on Bedrock (#10779)
* fix: fix get_complete_url

* test: test_anthropic_messages_bedrock_dynamic_region
2025-05-12 20:22:38 -07:00
Krrish Dholakia 2eb4aae26f fix(ollama_chat.py): fix key error + remove redundant code 2025-05-12 16:03:27 -07:00
Ishaan JaffandGitHub a4fb1da2d9 fix: pass application/json for GenericAPILogger (#10772)
* fix: pass application/json for GenericAPILogger

* fix: test_generic_api_callback
2025-05-12 14:15:33 -07:00
51930c07c5 [Fix]: /messages - allow using dynamic AWS params (#10769)
* fix: dynamic AWS params added for messages routes

* Update tests/pass_through_unit_tests/test_anthropic_messages_passthrough.py

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-12 14:09:17 -07:00
Ishaan JaffandGitHub 6de80a29cb [Feat] Add tools support for Nvidia NIM (#10763)
* feat:: add tools support for nvidia nim

* fix: test_chat_completion_nvidia_nim_with_tools
2025-05-12 14:07:35 -07:00
LouisSharkandGitHub e865a4cdda fix(factory.py): Add reasoning content handling for missing assistant… (#10688)
* fix(factory.py): Add reasoning content handling for missing assistant content

* fix(factory.py): Improve handling of thinking blocks for assistant content

* test(factory.py): Add test for Bedrock processing of thinking blocks with None content
2025-05-12 08:13:15 -07:00
Ashish Kumar VermaandGitHub 0eb0cf4515 Fixed Ollama Structured Response not working #10616 (#10617)
* Fixed Json.dumps in JSON Schema Validation Error

* Added Response Schema to Ollama chat for structured response

* Added Test cases

* refactor(ollama): remove redundant response_format check

The response_format parameter conversion is already handled in utils.py's
get_optional_params function, making the duplicate check in ollama_chat.py
unnecessary. This change removes the redundant code while maintaining the
same functionality.
2025-05-12 07:02:52 -07:00
Krish DholakiaandGitHub ec89f7d622 Handle gemini audio input (#10739)
* fix(vertex_ai/gemini/transformation.py): handle gemini audio data translation

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

* feat(vertex_ai/gemini/transformation.py): Handle audio format param translation

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

* fix: fix linting error

* test: update test

* fix: fix linting error
2025-05-11 00:23:18 -07:00
Krish DholakiaandGitHub beae5cfea9 Litellm staging 05 10 2025 - openai pdf url support + sagemaker chat content length error fix (#10724)
* Support pdf url's to openai (#10640)

* fix(gpt_transformation.py): support pdf url input to openai

pass as base64 as openai doesn't support image url's

* fix(openai.py): support async message transformation

allows async get request to convert url to base64

* fix(gpt_transformation.py): fix linting errrors and use common components across sync + async flows

* fix: fix linting errors

* fix(openai.py): pop correct var

* Fix sagemaker chat calls - content length error  (#10607)

* fix(sagemaker_chat/): support passing dynamic aws params

previously being ignored

* refactor(sagemaker/chat): more refactoring

* fix(sagemaker_chat/): make sure streaming is correctly handled post-refactor

* refactor: more refactoring to support using signed json str

* fix(sagemaker/chat): working sync streaming post refactor

* fix(sagemaker/chat): support async streaming post refactor

* fix(llm_http_handler.py): await async function

* fix: remove print statements

* test: update test

* test: update test

* fix(llm_http_handler.py): retain passing in data as json str

* test: update test

* fix(base_model_iterator.py): fix linting error

* test: test auth

* fix: fix linting error

* test: update test

* test: update translation test

* fix(gpt_transformation.py): handle awaitable/non-awaitable object

* fix: handle async flow for message transformation on openai compatible api's

* test: cleanup testing

* test: update test

* test(test_router.py): use model with higher quota

* test: simplify test

* test: update test
2025-05-10 17:41:57 -07:00
Ishaan Jaff d13117992c fix: test_init_custom_logger_compatible_class_as_callback 2025-05-10 17:26:12 -07:00
Krrish Dholakia 7934610f63 test: update test to handle rate limit error 2025-05-10 16:15:48 -07:00
Krrish Dholakia 7262e8a790 test: clear env var before running test 2025-05-10 14:49:55 -07:00
Ishaan JaffandGitHub 214a427038 fix: allow using credentials with amoderation (#10723) 2025-05-10 14:27:57 -07:00
Krish DholakiaandGitHub 7210b713dc Add target model name validation (#10722)
* fix(auth_checks.py): enforce auth checks on target model names

ensures user has access to models they are trying to call

* test(test_auth_utils.py): add unit tests for auth check

* fix(exception_mapping_utils.py): handle mistral 429 exception

* fix: fix linting error

* fix(auth_checks.py): add max fallback depth
2025-05-10 14:27:06 -07:00
Krish DholakiaandGitHub b8fe0e057f complete unified batch id support - replace model in jsonl to be deployment model name (#10719)
* feat(router.py): translate the model in jsonl for create file deployment to use the deployment model name

* test: add unit test for replace model in jsonl

* test(test_router.py): add unit tests

* test: add unit tests
2025-05-10 12:04:01 -07:00
Krish DholakiaandGitHub 8a8dc7ceda Litellm Unified File ID output file id support (#10713)
* fix(router.py): write file to all deployments

allows unified file id to work across multiple deployments

* fix(view_logs/index.tsx): show call type in request logs

* fix(router.py): pass a deep copy of kwargs to avoid conflict across multiple runs

* fix(batch_utils.py): broaden check

* fix(router_utils.py): handle null type for function name

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

* fix(router.py): handle healthy_deployments as a dict

* feat(managed_files.py): support encoding / decoding unified batch id … (#10711)

* feat(managed_files.py): support encoding / decoding unified batch id when using managed files

allows routing retrieve batch to the right model id

* fix: fix linting error

* feat(managed_files.py): support unified output file id

enables batch output file id to be used to retrieve the actual file

* fix(managed_files.py): attempt to fix ci/cd linting error

* fix: fix ruff check
2025-05-10 11:02:09 -07:00
Krish DholakiaandGitHub 9bfd3e4819 fix(router.py): write file to all deployments (#10708)
* fix(router.py): write file to all deployments

allows unified file id to work across multiple deployments

* fix(view_logs/index.tsx): show call type in request logs

* fix(router.py): pass a deep copy of kwargs to avoid conflict across multiple runs

* fix(batch_utils.py): broaden check

* fix(router_utils.py): handle null type for function name

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

* fix(router.py): handle healthy_deployments as a dict

* feat(managed_files.py): support encoding / decoding unified batch id … (#10711)

* feat(managed_files.py): support encoding / decoding unified batch id when using managed files

allows routing retrieve batch to the right model id

* fix: fix linting error

* test: add unit tests

* fix: fix ruff check
2025-05-10 00:08:30 -07:00
6084d6c437 Azure LLM: fix passing through of azure_ad_token_provider parameter (#10694)
* Azure LLM: fix passing through of azure_ad_token_provider parameter

* add test

---------

Co-authored-by: Clara Luise Pohland <clara-luise.pohland@telekom.de>
2025-05-09 23:38:13 -07:00
Krish DholakiaandGitHub 6f32189093 fix(caching_handler.py): fix embedding str caching result (#10700)
* fix(caching_handler.py): fix embedding str caching result

Fixes issue where str caching results were not being correctly assembled on str input

* feat(azure/image_generation): Support dropping response_format for azure gpt-image-1

Fixes LIT-118

* test(test_utils.py): add unit testing

* test: rename file to avoid testing conflict
2025-05-09 23:37:02 -07:00
Marc AbramowitzandGitHub 3d87da555a Add --version flag to litellm-proxy CLI (#10704)
* Add --version flag to litellm-proxy CLI

```shell
$ litellm-proxy --version
litellm-proxy version: 1.68.1
```

* Return both client and server version

* Update docs

* Add a test for the version command

* Add litellm/proxy/client/health.py
2025-05-09 18:58:37 -07:00
Ishaan JaffandGitHub e5a08a5ae1 [Feat] Add streaming support for using bedrock invoke models with /v1/messages (#10710)
* add basic bedrock transform

* test_anthropic_messages_streaming_bedrock_invoke

* fix: typing ant

* fix: get async response iterator

* fix: code quality check
2025-05-09 18:56:23 -07:00
Ishaan JaffandGitHub 3731ee436a [Refactor] Use pip package for enterprise/ folder (#10709)
* init enterprise pip

* init enterprise pip

* init enterprise pip

* test: enterprise pip

* add litellm-enterprise to pip

* litellm ent check

* litellm ent check

* fix import email router

* fix setup_litellm_enterprise_pip

* fix local testing with enterprise pip
2025-05-09 17:18:48 -07:00
479c6e4017 fix: support for python 3.11- (re datetime UTC) (#10471) (#10701)
* fix support for python 3.11-

3.11 introduced datetime.UTC, this provides a fallback for 3.11-

* use litellm.utils.get_utc_datetime

* remove unused timezone import

Co-authored-by: Matthew Farrellee <matt@cs.wisc.edu>
2025-05-09 14:13:57 -07:00
Ishaan Jaff 02efffcbcb fix: test_team_update_sc_2 2025-05-09 11:59:13 -07:00
Ishaan Jaff 1a42245da6 test: fix test_team_update_sc_2 2025-05-09 09:38:03 -07:00
Krrish Dholakia 584facebf1 test: temporarily skip test due to change testing model change - need to update test for new model 2025-05-09 09:02:08 -07:00
Krish DholakiaandGitHub d6bdd0473a Extract 'thinking' from nova response + Add 'drop_params' support for gpt-image-1 (#10680)
* test(base_llm_unit_tests.py): return '<thinking>' tag in response content

* fix(converse_transformation.py): extract `<thinking>` block from nova tool use response

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

* fix(factory.py): handle non-signature reasoning blocks to bedrock

pass as text input - bedrock raises ""User messages cannot contain reasoning content. Please remove the r
easoning content and try again." otherwise

* fix(main.py): Add drop params support for gpt

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

* fix(converse_transformation.py): fix linting error

* fix(utils.py): fix linting error

* test: cleanup test

* test: skip test until we have bedrock prompt caching permission
2025-05-08 23:01:38 -07:00
Krish DholakiaandGitHub a1964eab18 Realtime API - Set 'headers' in scope for websocket auth requests + reliability fix infinite loop when model_name not found for realtime models (#10679)
* fix(user_api_key_auth.py): add 'headers' to constructed request for websocket

Fix issue on some datastructure versions which require a headers field in scope

* test(test_user_api_key_auth.py): add unit testing for headers in scope change

* fix(router.py): migrate `_arealtime` to generic router endpoint

Fix infinite loop on model name missing for realtime api calls

* test(test_router_helper_utils.py): cleanup test post refactor
2025-05-08 22:50:09 -07:00
Krish DholakiaandGitHub 5325ee4382 fix(factory.py): Handle system only message to anthropic (#10678)
Fixes error where passing system only message to anthropic causes requests to fail
2025-05-08 22:44:39 -07:00
a0ee31edf8 [Feat] Add support for using Bedrock Invoke models in /v1/messages format (#10681)
* fix: add transform_anthropic_messages_request

* fix: add get_requested_response_api_optional_param

* fix: use base llm http handler for anthropic messages

* fix: add anthropic transform response

* fix: transform_anthropic_messages_response

* fix: fixes for anthropic messages

* fix: code qa fixes

* fix: pass thinking to anthropic

* fix: linting

* fixes

* feat: add folder for bedrock invoke messages

* feat: init bedrock invoke messages for anthropic claude family

* test: add bedrock invoke test for us anthropic

* test: test_anthropic_messages_non_streaming_bedrock_invokec

* feat: update anthropic messages transforms

* feat: update anthropic messages transforms

* Update litellm/utils.py

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

* fix: test_anthropic_messages_non_streaming

* fix: linting override

* fix: linting error

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-08 21:16:47 -07:00
Krrish Dholakia 49deea0df9 test: update test 2025-05-08 21:12:14 -07:00
Ishaan JaffandGitHub 9d8f570f14 [Refactor] Anthropic /v1/messages endpoint - Refactor to use base llm http handler and transformations (#10677)
* fix: add transform_anthropic_messages_request

* fix: add get_requested_response_api_optional_param

* fix: use base llm http handler for anthropic messages

* fix: add anthropic transform response

* fix: transform_anthropic_messages_response

* fix: fixes for anthropic messages

* fix: code qa fixes

* fix: pass thinking to anthropic

* fix: linting

* fixes
2025-05-08 17:56:50 -07:00
Ishaan JaffandGitHub d9f2415f65 [Refactor - Filtering Spend Logs] Add status to root of SpendLogs table (#10661)
* add status to spendlogs

* add status to spendlogs

* add status to spendlogs

* add status to spendlogs

* fix tests with spendlogs
2025-05-08 11:29:25 -07:00
Tom MatthewsandGitHub ff279faf35 Add support for Nscale (EU-Sovereign) Provider (#10638)
* Add support for nscale provider

* Add image generation support and fix unit tests

* Add docs for nscale

* Fix unit test import issues

* Minor doc improvement

* Remove redundant null tokens from model cost map

* Address PR review comments for doc updates

* Revert changes to large text
2025-05-08 08:50:15 -07:00
Gary CaldwellandGitHub 78c264d7a5 Fix Slack alerting not working if using a DB (#10370)
* Try to add prints

* more print

* fix print

* batch debugging

* Change batch size

* Revert "Change batch size"

This reverts commit af16d8635f17e3928da9000bb9fec5b0af920816.

* Look into periodic task problems

* Fix missing periodic in slack init

* Initialize periodic flush on startup

* Log update_values

* more logging

* Fix startup

* Cleanup change

* Add a unit test for the change

* Renamed and moved to standard

* Merging in with new test

* comment change

* Extend the timeout because normal runs are over 5 min
2025-05-08 08:40:05 -07:00
Krish DholakiaandGitHub b8b78f1fde Support unified file id (managed files) for batches (#10650)
* refactor(managed_files.py): move enterprise feature into enterprise folder

prevent unexpected surprises

* refactor: safely handle enterprise hooks

* fix: fix ruff check errors

* fix(files_endpoints.py): cleanup enterprise code from OSS

* refactor: complete cleanup

* fix(managed_files.py): complete cleanup

* fix(managed_files.py): instrument to be able to update deployment values post-router selection and just before making llm call

* fix(managed_files.py): instrument to be able to update deployment values post-router selection and just before making llm call

* fix: fix linting error

* fix: fix linting error
2025-05-07 23:39:40 -07:00
Marc AbramowitzandGitHub fcaa4a9f30 Add user management functionality to Python client library & CLI (#10627)
* Add user mgmt functionality to client & CLI

* Add user mgmt client & CLI tests

* Add user mgmt client & CLI info to README.md's

* lint fixes: litellm/proxy/client/users.py

* Fix mypy errors
2025-05-07 23:26:26 -07:00
CasparandGitHub d680feb5dc Fix cache miss for gemini models with response_format (#10635)
* Fix unwanted mutation of kwargs in apply_response_schema_transformation

* add assertion the original dict is not mutated
2025-05-07 23:13:37 -07:00
Ishaan Jaff 88f5f9b7f8 fix ai21 test 2025-05-07 21:45:57 -07:00
Ishaan Jaff 580e221000 fix ai21 test 2025-05-07 21:26:35 -07:00
Ishaan JaffandGitHub ad970ca41d [Feat] Add endpoints to manage email settings (#10646)
* add email notifs endpoints

* ui refactor email settings

* allow controlling email settings / notifs through ui

* add email settings to enterprise router

* change order of email events

* manage email settings in general_settings

* fix location of email settings types

* testing for email settings
2025-05-07 18:56:17 -07:00
Ishaan JaffandGitHub 6a3ea83b23 [Feat] Bedrock Guardrails - Add support for PII Masking with bedrock guardrails (#10642)
* allow defining mask_request_content for guardrails

* allow pii masking with bedrock

* implement bedrock pre call hook

* docs bedrock pii masking

* fix linting error

* fix code quality checks
2025-05-07 18:30:57 -07:00
Ishaan JaffandGitHub 1fb28c13a1 [Feat] Add User invitation emails when inviting users to litellm (#10615)
* working email integration

* fix get_custom_loggers_for_type

* add SendKeyCreatedEmailEvent type

* bug fix, only send 1 email when creating key for user

* polish for emails for key created

* polish for key created email

* fix test_init_custom_logger_compatible_class_as_callback

* testing resend email integration

* working user invitation email

* working user invite emails

* testing for user invite emails

* testing fixes for email integration
2025-05-06 22:52:53 -07:00
Ishaan JaffandGitHub dd32860d62 [Feat] V2 Emails - Fixes for sending emails when creating keys + Resend API support (#10602)
* working email integration

* fix get_custom_loggers_for_type

* add SendKeyCreatedEmailEvent type

* bug fix, only send 1 email when creating key for user

* polish for emails for key created

* polish for key created email

* fix test_init_custom_logger_compatible_class_as_callback

* testing resend email integration

* testing fixes for email integration
2025-05-06 22:50:48 -07:00
AravindandGitHub 4f162b0706 Fix: Ollama integration KeyError when using JSON response format (#10611)
* fix: Ollama JSON response handling to support arbitrary JSON structures. See #10589

* fix: linting issues and tests for #10589
2025-05-06 22:22:04 -07:00
Adam HolmbergandGitHub 33953bd6c8 make openai model O series conditional accept provider/model (#10591)
Registration and calls within the project are not consistent.
This accepts either form.

ref: #10566
2025-05-06 22:19:17 -07:00