Commit Graph

249 Commits

Author SHA1 Message Date
Ishaan Jaff 090f847bd9 [Feat] QA - Arize Team based logging (#12331)
* add _get_tracer_with_dynamic_headers

* fix construct_dynamic_arize_headers

* [Feat] UI - Allow Viewing/Editing Team Based Callbacks (#12329)

* add logging settings view on UI

* fix change ordering

* add construct_dynamic_otel_headers for arize

* refactor common code

* test_construct_dynamic_arize_headers

* otel unit tests

* test_arize_dynamic_params

* test_arize_dynamic_headers_in_grpc_requests
2025-07-04 18:17:09 -07:00
Ishaan Jaff ff7dd1756a [Security Bug Fix] Ensure only LLM API route fails get logged on Langfuse (and other loggers) (#12308)
* _is_proxy_only_llm_api_error

* test_proxy_only_error_true_for_llm_route

* add not on change

* Update tests/test_litellm/proxy/test_proxy_utils.py

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

* add test_post_call_failure_hook_auth_error_key_info_route

* test fix _is_proxy_only_llm_api_error

* test_chat_completion_request_with_redaction

* test_post_call_failure_hook_auth_error_llm_api_route

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-04 14:42:42 -07:00
Ishaan Jaff c3e673b627 [Feat] Add github co-pilot as a new LLM API provider (#12325)
* Litellm dev 03 05 2025 contributor prs (#9079)

* feat: add support for copilot provider

* test: add tests for github copilot

* chore: clean up github copilot authenticator

* test: add test for github copilot authenticator

* test: add test for github copilot for sonnet 3.7 thought model

* Fix #7629 - Add tzdata package to Dockerfile (#8915)

* Add tzdata package to Dockerfile

* Move tzdata to python requirement.txt

* feat: add support for copilot provider (#8577)

* feat: add support for copilot provider

* test: add tests for github copilot

* chore: clean up github copilot authenticator

* test: add test for github copilot authenticator

* test: add test for github copilot for sonnet 3.7 thought model

---------

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>

* feat: add model information for copilot models

* fix: fix linting errors

* test: remove integration test for github_copilot + fix misisng mock

* fix: use print to make sure the logger message shown

* test: remove debug print

* fix lint (#11112)

* Add init files to make test directories Python packages and update import paths in test_token_counter.py (#11119)

* Update litellm/model_prices_and_context_window_backup.json

Co-authored-by: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com>

---------

Co-authored-by: Son H. Nguyen <nhs.000.dev@gmail.com>
Co-authored-by: subnet.dev <50828879+subnet-dev@users.noreply.github.com>
Co-authored-by: Son H. Nguyen <33925625+nhs000@users.noreply.github.com>
Co-authored-by: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com>
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>

* refactor github copilot

* test_github_copilot_transformation.py

* test_github_copilot_authenticator.py

* add GitHub Copilot

* fix order

* doc fix

---------

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
Co-authored-by: Son H. Nguyen <nhs.000.dev@gmail.com>
Co-authored-by: subnet.dev <50828879+subnet-dev@users.noreply.github.com>
Co-authored-by: Son H. Nguyen <33925625+nhs000@users.noreply.github.com>
Co-authored-by: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com>
2025-07-04 13:12:16 -07:00
Joost van Doorn 453591ed7c Fix: Fix custom ca bundle support in aiohttp transport (#12281)
* Unify usage of get_ssl_configuration

* Fix doc
2025-07-04 12:48:20 -07:00
Ishaan Jaff 203a10a705 [Bug Fix] /generateContent API - Only pass supported params when using OpenAI models (#12297)
* fix - only pass GenericLiteLLMParams

* test_google_generate_content_with_openai
2025-07-04 12:08:10 -07:00
Ishaan Jaff 39955129f5 fix mapped tests (#12320)
* fix - use flush llm client cache

* faster mapped tests

* test_async_multiple_response_ids_routing

* fix tests

* test_ateam_member_update_admin_requires_premium

* regular mapped tests

* Revert "Fix: Initialize JSON logging for all loggers when JSON_LOGS=True (#12206)"

This reverts commit 2c60c316ec.

* reset num workers
2025-07-04 10:04:43 -07:00
Low Jian Sheng c2d5682a90 Fix gemini tool call sequence (#11999)
* fix gemini tool call sequence

* modify tests
2025-07-04 07:29:39 -07:00
Ishaan Jaff d774b08766 test_arouter_filter_team_based_models 2025-07-03 23:05:03 -07:00
Krish Dholakia a03390ccc7 Litellm dev 07 03 2025 p2 (#12301)
* fix(langfuse_prompt_management.py): add langfuse prompt version param support

Adds prompt versioning support

* test(test_langfuse_prompt_management.py): add unit test

* fix: fix linting errors

* fix: add prompt_version instrumentation

* fix(langfuse_otel.py): correctly read env var

* docs(langfuse_integration.md): clarify v3 recommendation is to use langfuse_otel

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

* docs(langfuse_otel_integration.md): cleanup docs

* test: fix test

* test: update tests

* fix: fix linting error
2025-07-03 22:40:21 -07:00
Ishaan Jaff 467dc4fa38 test router 2025-07-03 22:37:25 -07:00
Ishaan Jaff 7319d6b003 test llamafile 2025-07-03 22:35:22 -07:00
Ishaan Jaff 0835011388 test fix creds test 2025-07-03 22:01:52 -07:00
Cole McIntosh b6589a72c9 fix: Add size parameter support for Vertex AI image generation (#12292)
- Added 'size' to supported parameters for vertex_ai in get_optional_params_image_gen
- Implemented mapping from OpenAI size format (e.g., '1024x1024') to Vertex AI aspectRatio format (e.g., '1:1')
- Supports common aspect ratios: 1:1 (square), 16:9 (landscape), 9:16 (portrait)
- Added comprehensive test coverage for the size parameter mapping

Fixes LIT-279: Vertex AI Image Generation Aspect Ratio Support
2025-07-03 21:43:37 -07:00
Ishaan Jaff 9c8619ed10 test fix 2025-07-03 21:16:26 -07:00
Ishaan Jaff 81d96b9ffe fix test models 2025-07-03 21:16:26 -07:00
Krish Dholakia f755b70528 fix(factory.py): support optional args for bedrock (#12287)
* fix(factory.py): support optional args for bedrock

Closes https://github.com/BerriAI/litellm/pull/12276

* test(main.py): Support async await on mock_delay

Closes https://github.com/BerriAI/litellm/issues/12282
2025-07-03 21:15:10 -07:00
Ishaan Jaff bffe5bec7d test fix cli credentials 2025-07-03 21:08:35 -07:00
Ishaan Jaff e03686de5f tests fix use correct import responses 2025-07-03 21:06:31 -07:00
Ishaan Jaff 4293dd2c2a test: stabilize credentials CLI patch (#12305) 2025-07-03 18:09:32 -07:00
Ishaan Jaff 3ad6b36ffc test: patch CredentialsManagementClient in CLI (#12304) 2025-07-03 17:01:50 -07:00
Ishaan Jaff 782ba9f5a0 sys.path.insert for cli tests 2025-07-03 15:58:49 -07:00
Ishaan Jaff 81948d4198 fix test 2025-07-03 15:37:10 -07:00
Ishaan Jaff e75f4c8561 TestCallbackManagementEndpoints 2025-07-03 15:00:53 -07:00
Cole McIntosh adfe63cf3a fix: handle proxy internal callbacks in callback management test (#12294)
The test_list_callbacks_mixed_callback_types test was failing when run in parallel with other tests due to the proxy server's internal _PROXY_VirtualKeyModelMaxBudgetLimiter callback persisting across test runs. This fix filters out proxy internal callbacks from the test assertions to ensure consistent test behavior regardless of test execution order or parallelization.
2025-07-03 14:28:46 -07:00
Ishaan Jaff 9cc144e3cb test add clear_existing_callbacks 2025-07-03 12:00:36 -07:00
Ishaan Jaff 96d5f891df fix test 2025-07-03 11:18:41 -07:00
Ishaan Jaff ba5af3e44b fix keys delete 2025-07-03 11:18:10 -07:00
Krrish Dholakia 82a0a443c6 feat(stream_chunk_builder_utils.py): correctly return web_search_requests on stream chunk builder 2025-07-03 10:56:26 -07:00
Ishaan Jaff c3909d6f50 test_keys_delete_error_handling 2025-07-03 10:04:59 -07:00
dcieslak19973 d480cea8b0 Add azure_ai cohere rerank v3.5 (#12283)
* Add azure_ai cohere rerank v3.5

* Fix CI error
2025-07-03 10:01:45 -07:00
Ishaan Jaff 282ce1a859 test - fix delete keys 2025-07-02 22:23:10 -07:00
Krish Dholakia 42cd05dee8 Add Azure Content Safety Guardrails to LiteLLM proxy (#12268)
* feat(azure/prompt_shield.py): initial commit adding prompt shield guardrail + auto discovery mechanism for guardrails

reduces amount of code needed outside of guardrail integration for instrumentation

* feat(azure/prompt_shield.py): working azure prompt shield guardrail integration

Addresses https://github.com/BerriAI/litellm/issues/12254

* test: unit tests for prompt_shield

* fix(prompt_shield.py): add event hook validation for prompt shield guardrail

ensures prompt shield guardrail raises error if asked to run post_call (only runs on user prompt)

* feat(azure/): working text_moderation integration

* fix(text_moderation.py): suppress linting error

* test(test_azure_text_moderation.py): add unit test

* test(test_azure_text_moderation.py): add unit test for responses

* fix(text_moderation.py): return streaming error correctly

ensures error returned to user

* fix: fix linting error

* fix: fix linting check

* test: change mistral model

service tier exceeded

* fix(exception_mapping_utils.py): cover mistral in exception mapping
2025-07-02 21:34:19 -07:00
Krish Dholakia bba75aa12b Add 'audio_url' message type support for VLLM (#12270)
* fix(openai.py): add audio_url content type for vllm

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

* test: fix test
2025-07-02 20:37:45 -07:00
Jugal D. Bhatt 5fe01b9a2b Add MCP servers header to the scope of header (#12266)
* add mcp header param

* rename class

* fix tests

* fix tests

* added ruff fixes

* fix ruff checks

* added mypy type checking
2025-07-02 20:22:14 -07:00
Ishaan Jaff eef0623443 [Feat] Add Arize Team Based Logging (#12264)
* working KeyAndTeamLoggingSettings

* add arize_space_id to StandardCallbackDynamicParams

* add construct_dynamic_arize_headers

* add construct_dynamic_arize_headers to

* update otel arize logging

* fix imports

* test_construct_dynamic_arize_headers

* dynamic key/team settings

* test_get_dynamic_logging_metadata_with_arize_team_logging
2025-07-02 17:15:35 -07:00
Jugal D. Bhatt 5a852ca647 Add fix to tests (#12263) 2025-07-02 16:57:49 -07:00
Jugal D. Bhatt d55712b783 Add MCP url masking on frontend (#12247)
* add url masking on frontend

* fix test

* add signature
2025-07-02 16:32:26 -07:00
Nathan Brake 14feb5e454 feat: Turn Mistral to use llm_http_handler (#12245)
* Enhance Mistral API: Add support for parallel tool calls and refine name handling in tool messages. Plus, introduce a new test for parallel tool calls in the Mistral model.

* tests

* make mypy happy

* Refine name handling in Mistral chat transformation: clarify conditions for removing the 'name' field based on message role and content.

* refactor: streamline Mistral integration by removing deprecated references and adding a new handler

- Removed "mistral" from the list of compatible providers in constants.
- Updated the completion function in main.py to utilize the new Mistral handler.
- Deleted outdated Mistral chat and embedding files.
- Introduced a new handler for Mistral chat completions, implementing the llm_http_handler pattern.
- Added integration tests for the Mistral handler to ensure proper API base and key handling.

* lint

* fix: remove unneeded handler object

* add tests

* Addres PR comments
2025-07-02 14:01:56 -07:00
Krish Dholakia df49b24bc0 Azure - responses api bridge - respect responses/ + Gemini - generate content bridge - handle kwargs + litellm params containing stream (#12224)
* fix(main.py): handle router custom azure model name for responses api bridge

* fix(responses/handler): ensure azure model name is stripped before sending to provider

Fixes model name error

* fix(google_genai/main.py): handle stream=true being set in kwargs

* docs: cleanup icons from sidebar

* fix(test-litellm.yml): add google-genai to test litellmyml

* fix(main.py): strip 'responses/' from bridge

* fix(main.py): fix linting errors

* fix(types/openai.py): allow item to be none

handle azure streaming response

* fix(base.py): allow extra fields + handle azure item = none value in response output item added event

* fix(main.py): correctly handle removing responses/

* test(test_main.py): add unit tests
2025-07-02 13:53:52 -07:00
Cole McIntosh 2c60c316ec Fix: Initialize JSON logging for all loggers when JSON_LOGS=True (#12206)
When JSON_LOGS=True is set, error logs were not being formatted as JSON despite
the configuration. This was because the logging initialization code configured
individual loggers but failed to properly initialize all loggers with the JSON
formatter.

This fix ensures that when json_logs is enabled, the _initialize_loggers_with_handler()
function is called to:
- Configure all loggers (root, LiteLLM, Router, Proxy) with JSON formatter
- Disable logger propagation to prevent duplicate entries
- Set up exception handlers for JSON formatting

Fixes LIT-267
2025-07-02 12:18:28 -07:00
Nathan Brake c2dbc9c64b fix: mistral transform_response handling for empty string content (#12202)
* Enhance Mistral API: Add support for parallel tool calls and refine name handling in tool messages. Plus, introduce a new test for parallel tool calls in the Mistral model.

* tests

* make mypy happy

* Refine name handling in Mistral chat transformation: clarify conditions for removing the 'name' field based on message role and content.

* handle mistral returning '' instead of None
2025-07-01 22:31:50 -07:00
Jugal D. Bhatt d322e772f0 Litellm add sentry scrubbing (#12210)
* add sentry scrubbing

* add new constants

* remove_unused_import

* sentry scrubbing test

* added unit test
2025-07-01 20:42:36 -07:00
Ishaan Jaff 7471a30dcd Revert "Fix: Preserve full path structure for Gemini custom api_base (#12215)" (#12227)
This reverts commit f47254ecab.
2025-07-01 20:41:39 -07:00
Ishaan Jaff 4b4e2dfde4 test base email 2025-07-01 20:33:21 -07:00
Ishaan Jaff 66fafa3a7f [Feat] Polish - add better error validation when users configure prometheus metrics and labels to control cardinality (#12182)
* self._pretty_print_invalid_metric_error

* docs prometheus.md

* test prom validation checks

* update metric name

* fix _pretty_print_validation_errors

* fix linting

* test prometheus

* test fixes - prometheus
2025-07-01 20:17:17 -07:00
Samuel Boyd a5c2475ecf OpenMeter integration error handling fix (#12147)
* fix - tuple was never falsy so never triggered the exception

* test - add test suite for openmeter integration

* refactor - move tests for openmeter integration
2025-07-01 18:12:54 -07:00
Ishaan Jaff a6527e5010 [Feat] Add litellm-proxy cli login for starting to use litellm proxy (#12216)
* add handlers for auth commands

* add login, logout, whoami

* refactor auth

* add CLI Authentication Flow

* add SSO sign in constants

* add itellm-session-token

* fixes for managing state with cli

* use locally stored context for cli session

* add litellm banner + interactive shell

* update main.py

* update auth to show commands

* fix ui sso render

* add TestCLISSOCallbackFunction

* update banner.py

* remove file

* fix cli sso success

* TestTokenUtilities

* fix code qa

* fix execute_command

* fix cli_sso_callback

* fix import

* Authentication using CLI
2025-07-01 18:11:19 -07:00
Jason Roberts cc480f94c9 Fix/move panw prisma airs test file location per feedback on PR #12116 (#12175)
* Move PANW Prisma AIRS test per feedback on PR #12116

- Move test to tests/test_litellm/proxy/guardrails/guardrail_hooks/

* Remove test file from old location
2025-07-01 18:08:04 -07:00
Zayd 7ef590df84 Passes through extra_ properties on "custom" llm provider (#12185)
* Passes through headers on "custom" llm provider

* add test

* adds extra_body support for custom llm providers
2025-07-01 18:07:38 -07:00
Ciprian Tomoiaga b3b4c65ac4 Fix default parameters for ollama-chat (#12201) 2025-07-01 17:59:04 -07:00