Commit graph

12648 commits

Author SHA1 Message Date
Jugal D. Bhatt
bfabf2709a
[LLM translation] Fix bedrock computer use #13143 (#13150)
* fix json test

* fix pr

* fix bedrock computer use tool

* added unit test

* fix failing prisma tesT

* fix prisma connect
2025-08-01 15:02:44 -07:00
Krrish Dholakia
d158a0344d test: update unit tests 2025-08-01 13:37:51 -07:00
Krrish Dholakia
72fd4e3d55 test: remove bad unit tests 2025-08-01 13:34:23 -07:00
Timothy Lowrimore
71f8fb1d27
Merge branch 'main' into heroku-llms 2025-08-01 11:24:32 -06:00
Krrish Dholakia
e3c9fc458d test: update tests 2025-08-01 09:19:31 -07:00
Krrish Dholakia
461b615bde test: update tests 2025-08-01 09:12:44 -07:00
Krrish Dholakia
952c2b5215 test: update test 2025-08-01 09:07:53 -07:00
Josh
15dbf4118f
Merge branch 'main' into add-vercel-ai-gateway-provider 2025-08-01 00:05:10 -07:00
joshualipman123
7a999e0f0f Convert integration tests to mocks 2025-07-31 23:57:53 -07:00
Krrish Dholakia
fe24c270de Prompt Management - add local dotprompt file support 2025-07-31 22:28:29 -07:00
Jason Roberts
04c299410e
Fix/panw prisma airs post call hook (#13185)
* fix(guardrails): Fix PANW Prisma AIRS post-call hook method name

- Changed async_post_call_hook to async_post_call_success_hook to match proxy calling convention
- Added event_hook parameter to initialization to ensure proper hook registration
- Fixes post-call response scanning for PANW Prisma AIRS guardrails

Resolves issue where post-call hooks were not being invoked due to method name mismatch.

* Update PANW Prisma AIRS tests to use correct method name
2025-07-31 21:50:32 -07:00
Krish Dholakia
78997c2e35
Anthropic - working mid-stream fallbacks (#13149)
* fix(router.py): add acompletion_streaming_iterator inside router

allows router to catch errors mid-stream for fallbacks

Work for https://github.com/BerriAI/litellm/issues/6532

* fix(router.py): working mid-stream fallbacks

* fix(router.py): more iterations

* fix(router.py): working mid-stream fallbacks with fallbacks set on router

* fix(router.py): pass prior content back in new request as assistant prefix message

* fix(router.py): add a system prompt to help guide non-prefix supporting models to use the continued text correctly

* fix(common_utils.py): support converting `prefix: true` for non-prefix supporting models

* fix: reduce LOC in function

* test(test_router.py): add unit tests for new function

* test: add basic unit test

* fix(router.py): ensure return type of fallback stream is compatible with CustomStreamWrapper

prevent client code from breaking

* fix: cleanup

* test: update test

* fix: fix linting error
2025-07-31 21:22:49 -07:00
Krish Dholakia
c7e4435bdc
Fix - using managed files w/ OTEL + UI - add model group alias on UI (#13171)
* fix(router.py): safe deep copy kwargs

OTEL adds a parent_otel_span which cannot be deepcopied

* fix: use safe deep copy in other places as well

* test: add script to check and ban copy.deepcopy of kwargs

enforce safe_deep_copy usage

* build(ui/): new component for adding model group alias on UI

* fix(proxy_server.py): support updating model_group_alias via /config/update

allows ui component to work

* fix(router.py): update model_group_alias in router settings based on db value

* fix: fix code qa error
2025-07-31 21:22:04 -07:00
Josh
fde381a396 Merge branch 'main' into add-vercel-ai-gateway-provider 2025-07-31 18:49:03 -07:00
Cole McIntosh
0666ede8e3
fix: correct patch path in langfuse test for MAX_LANGFUSE_INITIALIZED_CLIENTS (#13192)
The test was failing because it was trying to patch MAX_LANGFUSE_INITIALIZED_CLIENTS
at the wrong path. The constant is imported from litellm.constants into the langfuse
module namespace, so we need to use patch.object on the imported module reference.

Changes:
- Import langfuse module explicitly for patching
- Use patch.object instead of patch string path
- This fixes the AttributeError that was causing CI failures
2025-07-31 17:11:28 -07:00
Ishaan Jaff
ee70d593c1
[Feat] Allow redacting message / response content for specific logging integrations - DD LLM Observability (#13158)
* fix redact_standard_logging_payload

* add StandardCustomLoggerInitParams

* allow defining DatadogLLMObsInitParams

* fix init DataDogLLMObsLogger

* fix import

* update redact_standard_logging_payload_from_model_call_details

* test_dd_llms_obs_redaction

* docs DD logging

* docs DD

* docs DD

* Redacting Messages, Response docs DD LLM Obs

* fix redaction logic

* fix create_llm_obs_payload

* fix logging response

* fixes

* ruff fix

* fix test

* test_dd_llms_obs_redaction

* test_create_llm_obs_payload

* redact_standard_logging_payload_from_model_call_details

* img - dd_llm_obs

* docs DD

* fix linting

* fix linting

* fix mypy

* test_create_llm_obs_payload

* test_create_llm_obs_payload

* fix mock_env_vars

* fix _handle_anthropic_messages_response_logging
2025-07-31 16:44:16 -07:00
Ishaan Jaff
115d2480c1
[Bug Fix] Infra - ensure that stale Prisma clients disconnect DB connection (#13140)
* ensure original client is disconnected when re-creating

* test_recreate_prisma_client_successful_disconnect

* test_recreate_prisma_client_successful_disconnect
2025-07-31 16:43:26 -07:00
Ishaan Jaff
cbb922b1bb
[Bug Fix] Gemini-CLI Integration - ensure tool calling works as expected on generateContent (#13189)
* transform_generate_content_request

* add tools in GenerateContentRequestDict

* add generate_content_handler tool calling

* google_generate_content_endpoint_testing

* test_mock_stream_generate_content_with_tools

* test_validate_post_request_parameters

* fixes for generate_content_handler

* fix VertexAIGoogleGenAIConfig

* fixes veretx ai

* google_generate_content_endpoint_testing

* test_async_streaming_with_logging

* load_vertex_ai_credentials

* test_vertex_anthropic.py
2025-07-31 16:42:57 -07:00
Anand Khinvasara
212a339954
fix: support negative indexes in cache_control_injection_points for Anthropic Claude (#10226) (#13187) 2025-07-31 15:50:53 -07:00
Timothy Lowrimore
a973202cb1
Merge branch 'main' into heroku-llms 2025-07-31 15:47:48 -06:00
Jugal D. Bhatt
524a1ffd5f
[Proxy Startup]fix db config through envs (#13111)
* fix db config through envs

* add helper

* fix ruff

* fix imports

* add unit tests in db config changes
2025-07-31 13:52:56 -07:00
Ishaan Jaff
79be436c2b
[Feat] Background Health Checks - Allow disabling background health checks for a specific (#13186)
* disable background health checks for specific models

* test_background_health_check_skip_disabled_models

* Disable Background Health Checks For Specific Models
2025-07-31 13:48:35 -07:00
Ishaan Jaff
65ca4f66f6 Revert "add framework name to UserAgent header in AWS Bedrock API call (#13159)"
This reverts commit 77f506e860.
2025-07-30 23:12:36 -07:00
Ishaan Jaff
fad453bbf3 test_chat_completion_ratelimit 2025-07-30 23:12:11 -07:00
0x-fang
77f506e860
add framework name to UserAgent header in AWS Bedrock API call (#13159) 2025-07-30 22:44:22 -07:00
Krish Dholakia
c6a8733234
build(config.yml): migrate build_and_test to ci/cd pg db (#13166) 2025-07-30 18:19:36 -07:00
Ishaan Jaff
cf4c639dad test fix xai - it goes through base llm tests already 2025-07-30 18:18:49 -07:00
Krrish Dholakia
09cc748871 test: handle api instability 2025-07-30 16:32:23 -07:00
Ishaan Jaff
090e2ffb5a Revert "[LLM translation] Fix bedrock computer use (#13143)"
This reverts commit 840dd2e7c7.
2025-07-30 16:03:35 -07:00
Jugal D. Bhatt
5db4862cbf
[MCP Gateway] Litellm mcp client list fail (#13114)
* fix headers

* fix test

* fix ruff

* added try except for catching errors which lead to client failures

* fix mypy

* fix ruff

* fix tests

* fix python error

* fix test

* fix test

* fixed the MCP Call Tool result
2025-07-30 15:23:19 -07:00
Jugal D. Bhatt
eb8a338d9b
[MCP Guardrails] move pre and during hooks to ProxyLoggin (#13109)
* move pre and during hooks t o ProxyLoggin

* fix lint

* fix ruff

* fix tests
2025-07-30 13:58:41 -07:00
betterthanbreakfast
51a103c351 [Bug]: Set user from token user_id for OpenMeter integration 2025-07-30 22:23:30 +02:00
Jugal D. Bhatt
840dd2e7c7
[LLM translation] Fix bedrock computer use (#13143)
* Add support for bedrock computer use

* remove print

* split bedrock tools

* add hosted tools

* fix tool use

* fix tool use

* fix function calling

* fix converse transformation

* fix tests

* fix llm translation test

* fix computer use
2025-07-30 12:27:12 -07:00
Jason Jensen
9b75b6915d test(customer): add unit tests for customer budget update functionality 2025-07-30 17:01:18 +00:00
joshualipman123
1ea28ccf67 Add Vercel AI Gateway provider support 2025-07-30 10:01:05 -07:00
Jason Jensen
1181f1bb2e test(customer): add unit tests for budget_id handling in customer update endpoint 2025-07-30 16:47:25 +00:00
Jugal D. Bhatt
e324f76859
[MCP Gateway] add health check endpoints for MCP (#13106)
* add health check endpoints for MCP

* add import

* Clean up endpopints

* fix ruff
2025-07-30 20:40:44 +05:30
Johnny.H
97d89584c1
fix tool aws bedrock call index when the function only have optional arg (#13115) 2025-07-29 22:07:24 -07:00
Krrish Dholakia
ae947e63ce test: update test 2025-07-29 22:07:07 -07:00
Krish Dholakia
ea6b4b08d3
move to use_prisma_migrate by default + resolve team-only models on auth checks + UI - add sagemaker on UI (#13117)
* fix(proxy_cli.py): make use_prisma_migrate proxy default

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

 Prisma migrate deploy prevents resetting db

* fix(auth_checks.py): resolve team only models while doing auth checks on model access groups

Fixes issue where key had access via an access group, but team only model could not be called

* test(test_router.py): add unit testing

* feat(provider_specific_fields.tsx): add aws sagemaker on UI
2025-07-29 21:56:18 -07:00
Krrish Dholakia
7e5bc8af28 test: update test 2025-07-29 21:35:44 -07:00
Krish Dholakia
1c182919b5
Revert "[LLM translation] Add support for bedrock computer use (#12948)" (#13118)
This reverts commit 760d747465.
2025-07-29 21:33:46 -07:00
Krrish Dholakia
f544a4e238 test: update test 2025-07-29 21:08:36 -07:00
Ishaan Jaff
1af0743e58 Revert "Revert "[MCP Gateway] Add protocol headers (#13062)""
This reverts commit acd915f2db.
2025-07-29 18:14:31 -07:00
Ishaan Jaff
50466e0077 test_user_api_key_auth 2025-07-29 18:01:40 -07:00
Ishaan Jaff
d10a5a69af fix test_mlflow_request_tags_functionality 2025-07-29 17:33:24 -07:00
Ishaan Jaff
acd915f2db Revert "[MCP Gateway] Add protocol headers (#13062)"
This reverts commit 8de24bab7c.
2025-07-29 17:26:00 -07:00
Jugal D. Bhatt
760d747465
[LLM translation] Add support for bedrock computer use (#12948)
* Add support for bedrock computer use

* remove print

* split bedrock tools

* add hosted tools

* fix tool use

* fix tool use

* fix function calling

* fix converse transformation

* fix tests
2025-07-29 16:52:23 -07:00
Ishaan Jaff
5fa2b00c3f
[Feat] MLFlow Logging - Allow adding tags for ML Flow logging requests (#13108)
* add mlflow tags

* fixes config

* add litellm mlflow

* test_mlflow_request_tags_functionality

* docs ML flow litellm proxy

* docs ml flow

* docs mlflow
2025-07-29 16:51:27 -07:00
Cole McIntosh
8826e02a98
feat: Add dot notation support for all JWT fields (#13013)
* feat: Add dot notation support for all JWT fields

- Updated all JWT field access methods to use get_nested_value for dot notation support
- Enhanced get_team_id to properly handle team_id_default fallback with nested fields
- Added comprehensive unit tests for nested JWT field access and edge cases
- Updated documentation to reflect dot notation support across all JWT fields
- Maintains full backward compatibility with existing flat field configurations

Supported fields with dot notation:
- team_id_jwt_field, team_ids_jwt_field, user_id_jwt_field
- user_email_jwt_field, org_id_jwt_field, object_id_jwt_field
- end_user_id_jwt_field (roles_jwt_field was already supported)

Example: user_id_jwt_field: 'user.sub' accesses token['user']['sub']

* fix: Add type annotations to resolve mypy errors

- Add explicit type annotation for team_ids variable in get_team_ids_from_jwt
- Add type ignore comment for sentinel object return in get_team_id
- Resolves mypy errors while maintaining functionality

* fix: Resolve mypy type error in get_team_ids_from_jwt

- Remove explicit List[str] type annotation that conflicts with get_nested_value return type
- Simplify return logic to use 'team_ids or []' ensuring always returns List[str]
- Fixes: Incompatible types in assignment (expression has type 'list[str] | None', variable has type 'list[str]')

* fix: Add proper type annotation for team_ids variable

- Use Optional[List[str]] type annotation to satisfy mypy requirements
- Resolves: Need type annotation for 'team_ids' [var-annotated]
- Maintains functionality while ensuring type safety

* refactor: remove outdated JWT unit tests and consolidate JWT-related functionality

- Deleted the test_jwt.py file as it contained outdated and redundant tests.
- Consolidated JWT-related tests into test_handle_jwt.py for better organization and maintainability.
- Updated tests to ensure proper functionality of JWT handling, including token validation and role mapping.
- Enhanced test coverage for JWT field access and nested claims handling.

* test: add comprehensive unit tests for JWT authentication

- Introduced a new test file `test_jwt.py` containing unit tests for JWT authentication.
- Implemented tests for loading configuration with custom role names, validating tokens, and handling team tokens.
- Enhanced coverage for JWT field access, nested claims, and role-based access control.
- Added fixtures for Prisma client and public JWT key generation to support testing.
- Ensured proper handling of valid and invalid tokens, including user and team scenarios.

* revert test_handle_jwt.py

* rename file

* test: remove outdated JWT nesting tests and add new nested field access tests

- Deleted the `test_jwt_nesting.py` file as it contained outdated tests.
- Introduced new tests in `test_handle_jwt.py` to verify nested JWT field access.
- Enhanced coverage for accessing nested values using dot notation and ensured backward compatibility with flat field names.
- Added tests for handling missing nested paths and appropriate default values.
- Improved handling of metadata prefixes in nested field access.

* restore file
2025-07-29 16:51:17 -07:00