Commit Graph

6579 Commits

Author SHA1 Message Date
Julio Quinteros Pro 81faad5d0d fix(tests): skip prisma DB test and sync root schema.prisma with spec_path field
- Add @pytest.mark.skip to test_create_audit_log_in_db which requires
  a live Prisma/PostgreSQL DB connection unavailable in CI
- Sync root schema.prisma with litellm/proxy/schema.prisma by adding
  the spec_path field to LiteLLM_MCPServerTable, fixing
  test_aaaasschema_migration_check which detected this drift

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 12:29:53 -03:00
jquinter db0c309a31 Merge pull request #21670 from BerriAI/fix/gemini3-medium-reasoning-effort-test
fix(tests): correct medium reasoning_effort assertion for gemini-3-pro-preview
2026-02-20 12:19:19 -03:00
jquinter 9ea5f52583 Merge pull request #21669 from BerriAI/fix/skip-tests-requiring-external-services
fix(tests): skip CI tests requiring external services (DB, API keys)
2026-02-20 12:18:56 -03:00
jquinter eb2781552b Merge pull request #21668 from BerriAI/fix/model-max-budget-test-needs-premium-user
fix(tests): set premium_user=True in test_aasync_call_with_key_over_model_budget
2026-02-20 12:18:29 -03:00
Julio Quinteros Pro 87577eb05c fix(tests): correct medium reasoning_effort assertion for gemini-3-pro-preview
For gemini-3-pro-preview (not gemini-3-flash or gemini-3.1-pro-preview),
reasoning_effort="medium" maps to thinkingLevel="high" because the "medium"
thinking level is not available on that model variant.

Both test_reasoning_effort_maps_to_thinking_level_gemini_3 and
test_reasoning_effort_dict_format_gemini_3 had the correct comment
("medium -> high") but the wrong assertion (== "medium"). Fixed to
match the production code and the comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 12:09:26 -03:00
Julio Quinteros Pro 3dd58b42ce fix(tests): skip more CI tests requiring external DB/Redis connections
Mark additional tests that fail due to unavailable Prisma DB or Redis
in CI with @pytest.mark.skip.

test_key_generate_prisma.py (Prisma DB):
- test_call_with_valid_model
- test_call_with_valid_model_using_all_models
- test_call_with_user_over_budget
- test_call_with_user_over_budget_stream
- test_call_with_proxy_over_budget
- test_call_with_proxy_over_budget_stream
- test_call_with_key_over_budget
- test_call_with_key_over_budget_no_cache
- test_call_with_key_over_budget_stream
- test_create_update_team

test_e2e_pod_lock_manager.py (Redis):
- test_pod_lock_acquisition_when_no_active_lock
- test_pod_lock_acquisition_after_completion
- test_pod_lock_acquisition_after_expiry
- test_pod_lock_release
- test_concurrent_lock_acquisition
- test_lock_acquisition_with_expired_ttl
- test_release_expired_lock
- test_e2e_size_of_redis_buffer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:49:38 -03:00
Julio Quinteros Pro ce59e6f00a fix(tests): use unconditional skip for vertex/gemini token counting test
The parametrized test covers both gemini-2.5-pro (needs GEMINI_API_KEY)
and vertex-ai-gemini-2.5-pro (needs VERTEX_AI_PRIVATE_KEY). A skipif
on GEMINI_API_KEY alone was insufficient for the vertex variant.
Switch to @pytest.mark.skip to guard both parametrizations consistently.

Addresses Greptile review comment on PR #21669.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:36:54 -03:00
Julio Quinteros Pro 174c17cec1 fix(tests): skip additional CI tests requiring external DB connection
Mark DB-dependent tests in test_key_generate_prisma.py and test_jwt.py
with @pytest.mark.skip to prevent CI failures when Prisma DB is unavailable.

Tests now skipped:
- test_call_with_invalid_key
- test_call_with_invalid_model
- test_call_with_end_user_over_budget
- test_aasync_call_with_key_over_model_budget (all 3 parametrize variants)
- test_call_with_key_never_over_budget
- test_aview_spend_per_user
- test_aadmin_only_routes
- test_auth_vertex_ai_route
- test_team_token_output (both audience variants)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:35:43 -03:00
Julio Quinteros Pro 3dfa3611d9 fix(tests): skip CI tests requiring external services (DB, API keys)
Mark tests that require Prisma DB connections or external API credentials
with @pytest.mark.skip / @pytest.mark.skipif so they don't block CI runs
when the infrastructure is unavailable.

Tests skipped:
- test_create_user_default_budget (Prisma DB)
- test_gemini_pass_through_endpoint (GEMINI_API_KEY / GOOGLE_API_KEY)
- test_vertex_ai_gemini_token_counting_with_contents (Google API creds)
- test_new/update/delete/info_project (Prisma DB)
- test_create/list/get/delete_skill_sdk (Prisma DB)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:28:42 -03:00
Julio Quinteros Pro 1f6303677c fix(tests): set premium_user=True in test_aasync_call_with_key_over_model_budget
generate_key_fn calls validate_model_max_budget which raises
"You must have an enterprise license to set model_max_budget" unless
premium_user=True. The test was hitting this gate before it could
exercise the actual per-model budget logic, causing all three variants
to fail with an enterprise-check error instead of the expected budget
exceeded / pass-through result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:12:38 -03:00
Julio Quinteros Pro 963e0eabcb fix(tests): update test_max_effort_rejected_for_opus_45 regex to match new error message
The production error message was expanded when Sonnet 4.6 was also added as
a supported model for effort='max'. The test's match regex still referenced
the old "Claude Opus 4.6"-only message; update it to match the new
"Claude 4.6 models" wording.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:07:52 -03:00
Sameer Kankute b62db9fcc9 Merge pull request #21663 from BerriAI/litellm_add_reasoning_support_config
[Feat] Add reasoning support via config
2026-02-20 18:17:09 +05:30
Sameer Kankute 164734fa45 Merge pull request #21662 from BerriAI/litellm_mcp_openapi_spec
[Fix]Add mcp via openapi spec
2026-02-20 18:16:30 +05:30
Sameer Kankute 9e0bd46c28 Merge pull request #21659 from BerriAI/litellm_fix_converse_disable_tool
Fix mapping of parallel_tool_calls for bedrock converse
2026-02-20 18:16:10 +05:30
Sameer Kankute 5d8f2196d1 Add test case 2026-02-20 16:22:44 +05:30
Sameer Kankute ba74ee5a31 Add test for base url extraction and migration 2026-02-20 13:47:44 +05:30
Sameer Kankute b579f56ca3 Fix mapping of parallel_tool_calls for bedrock converse 2026-02-20 12:27:41 +05:30
Sameer Kankute cdb4917185 Fix: api_base is required. Unable to determine the correct api_base for the request 2026-02-20 12:09:25 +05:30
jquinter 898774fecf Merge pull request #21643 from BerriAI/fix/redis-cache-test-missing-host
fix(tests): pass host to RedisCache in test_team_update_redis
2026-02-20 01:11:04 -03:00
Sameer Kankute fb75a7130f Merge pull request #21630 from Chesars/fix/empty-system-message-anthropic
fix(anthropic): empty system messages in translate_system_message
2026-02-20 09:32:50 +05:30
Julio Quinteros Pro bd8c1cc673 fix(tests): pass host to RedisCache in test_team_update_redis to avoid ValueError
RedisCache() without arguments fails at construction with
"ValueError: Either 'host' or 'url' must be specified for redis."
The actual Redis connection is irrelevant since async_set_cache is mocked.
Unlike test_get_team_redis which uses client_no_auth (which sets REDIS_HOST
via fake_env_vars), test_team_update_redis has no fixture setting that env var.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 01:00:58 -03:00
jquinter 6b681aafdd Merge pull request #21641 from BerriAI/fix/jwt-tests-missing-premium-user-flag
fix(tests): set premium_user=True in JWT tests that call user_api_key_auth
2026-02-20 00:45:13 -03:00
Julio Quinteros Pro cde51a53a7 fix(tests): set premium_user=True in JWT tests that call user_api_key_auth
JWT auth is an enterprise-only feature. Tests that call user_api_key_auth
with enable_jwt_auth=True must set premium_user=True on the proxy server
to bypass the enterprise gate, otherwise they fail with:

  ValueError: JWT Auth is an enterprise only feature.

This follows the same pattern as PR #21285 (fix/jwt-enterprise-license-test).

Fixed tests:
- test_team_token_output
- test_allowed_routes_admin
- test_allow_access_by_email
- test_end_user_jwt_auth

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 00:31:56 -03:00
Sameer Kankute b405f64688 Merge pull request #21598 from jtsaw/fix/anthropic-sonnet-4-6-reasoning-effort
support reasoning and effort parameters on sonnet 4.6
2026-02-20 08:24:29 +05:30
Chesars 56386969b5 fix(anthropic): remove empty system messages from message list
Empty system messages were skipped for Anthropic's system param but
not removed from the messages list, causing BadRequestError when
anthropic_messages_pt encountered the unsupported "system" role.

Fixes #21622
2026-02-19 21:46:17 -03:00
yuneng-jiang c7fe400d4d [Fix] Service account visibility for team members
Regular team members could not see service accounts belonging to their
team. Additionally, former team members could still see service accounts
they created via the created_by filter after leaving the team.

- Add get_member_team_ids() to retrieve all teams a user belongs to
- Regular members now see team service accounts (user_id=NULL) but not
  other members' personal keys
- Scope created_by filter to the user's current team memberships
- Add 7 unit tests covering the new visibility rules
2026-02-19 16:29:43 -08:00
Ishaan Jaff 3d8c042ca5 feat: prompt injection guardrail policy template (#21520)
* add semantic guard constants

* add SEMANTIC_GUARD enum value

* add keyword-based prompt injection policy template

* add semantic prompt injection route template

* add semantic guard route loader

* add semantic guard guardrail

* add semantic guard registration

* add semantic guard tests

* enhance SQL injection keyword category with more patterns and exceptions

* add standalone SQL injection policy template

* add SQL injection semantic guard route template

* add SQL injection guardrail tests

* remove standalone sql_injection policy template, use categories/prompt_injection_sql.yaml instead
2026-02-19 15:06:06 -08:00
jquinter f106c97bf2 Merge pull request #21609 from BerriAI/fix/delete-keys-return-failed-tokens
fix(key management): return failed_tokens in delete_verification_tokens response
2026-02-19 19:31:39 -03:00
Julio Quinteros Pro b9f36645f3 fix(key management): populate failed_tokens for admin partial-delete path
The admin bulk-delete path (prisma_client.delete_data) was never comparing
the DB return value against the requested tokens, so failed_tokens was
always empty for admins even when the DB silently skipped some tokens.

Adds the same mismatch check as the non-admin path, and a new test that
exercises admin bulk-delete returning fewer tokens than requested.

Fixes gap identified by Greptile review on #21609.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 19:28:03 -03:00
Julio Quinteros Pro 079bc364bb fix(key management): return failed_tokens in delete_verification_tokens response
Instead of raising an exception when some requested tokens are not found
in the DB, populate `failed_tokens` in the return dict so callers can
inspect which keys were not deleted without catching a generic Exception.

Supersedes #12577.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 19:10:55 -03:00
Ishaan Jaff c9cdce96fa feat(policy): test playground for AI policy suggestions (#21608)
* fix aviation safety topic filter: remove overly broad exceptions, add cockpit access block words

* fix airline brand protection filter: add identifier words, competitor/ops block words, tighten exceptions

* feat(policy): add POST /policy/templates/test endpoint for testing guardrails before creating them

* feat(ui): add testPolicyTemplate networking function

* feat(ui): add test playground to AI policy suggestion modal

* test(policy): add tests for POST /policy/templates/test endpoint
2026-02-19 14:09:20 -08:00
Ishaan Jaff 779c355f1e feat: add airline off-topic restriction policy template (#21607)
* fix aviation safety topic filter: remove overly broad exceptions, add cockpit access block words

* fix airline brand protection filter: add identifier words, competitor/ops block words, tighten exceptions

* feat: add airline off-topic restriction policy template

* feat: register airline off-topic restriction in policy templates backup

* test: add tests for airline off-topic restriction policy template

* fix: remove overly broad block words (explain, recommend, suggest, best) to reduce false positives

* test: add false-positive tests for recommend/explain airline queries
2026-02-19 13:45:59 -08:00
Ishaan Jaff e9a07347dc fix: reduce proxy overhead for large base64 payloads (#21594)
* fix aviation safety topic filter: remove overly broad exceptions, add cockpit access block words

* fix airline brand protection filter: add identifier words, competitor/ops block words, tighten exceptions

* add constants for large payload handling and detailed timing

* add base64 truncation for logging payloads

* use shallow copy for messages, track copy and callback timing

* add callback duration and detailed timing to response metadata

* add callback duration header, size-gate debug logging, detailed timing headers

* add tests for callback timing, base64 truncation, and detailed timing

* fix code quality: extract helpers, fix regex, clean up imports

* rewrite _truncate_base64_in_value iteratively to satisfy recursive detector
2026-02-19 12:10:52 -08:00
Ishaan Jaff b209b11522 feat: AI policy template suggestions (#21589)
* fix aviation safety topic filter: remove overly broad exceptions, add cockpit access block words

* fix airline brand protection filter: add identifier words, competitor/ops block words, tighten exceptions

* add example_sentences to all policy templates + topic-filtering and prompt-injection templates

* add policy_endpoints package with AI policy suggester

* update test patch targets for policy_endpoints package move

* add unit tests for AI policy suggester

* add suggestPolicyTemplates networking function

* add AI suggestion modal component

* add Use AI button and template loading callback to PolicyTemplates

* wire up AI suggestion modal in policies page

* fix policy_templates_backup.json path after package move

* add estimated_latency field to all policy templates

* use llm_router and accept model parameter in ai_policy_suggester

* add model param to suggest templates endpoint

* pass model param in suggestPolicyTemplates

* polish ai suggestion modal: model selector, auto-growing textareas, latency badges

* add template queue for processing multiple AI-suggested templates

* show template progress badge in guardrail selection modal
2026-02-19 12:00:26 -08:00
jtsaw b28ec1c75e support reasoning + effort on sonnet 4.6 2026-02-19 11:54:55 -08:00
michelligabriele 16cfdccc7b fix(bedrock): add Accept header for AgentCore MCP server requests (#21551)
AgentCore MCP server endpoints require the Accept header to contain
both application/json and text/event-stream per the MCP specification
(Streamable HTTP transport). Without this header, requests are rejected
with a 406 Not Acceptable error (JSON-RPC code -32011).

Sets the Accept header at the top of sign_request() so both JWT/Bearer
and SigV4 authentication paths include it.
2026-02-19 11:35:14 -08:00
milan-berri 506d1dff43 fix: handle deprovisioning operations without path field (#21571)
* fix(scim): handle deprovisioning operations without path field

When SCIM providers send deprovisioning requests without a path field
(e.g., {"op": "replace", "value": {"active": false}}), the code was
storing the value under an empty string key in metadata.

This fix:
- Detects operations with no path where value is a dict
- Extracts and handles known fields like 'active' correctly
- Sets metadata["scim_active"] = false instead of metadata[""] = {"active": false}

Fixes: SCIM deprovisioning creating empty string keys in user metadata

* fix(scim): handle all known fields in operations without path

Extended the fix to handle all SCIM fields (not just active) when
operations have no path field:
- active -> scim_active
- displayName -> user_alias
- externalId -> user_id
- name.givenName/familyName -> scim_metadata

Added comprehensive test for multiple fields without path.

Addresses Greptile review feedback on RFC 7644 compliance.

* trigger PR update
2026-02-19 11:09:04 -08:00
yuneng-jiang c911cfbabf Merge remote-tracking branch 'origin' into litellm_key_last_active_tracking 2026-02-19 10:27:48 -08:00
Sameer Kankute 9f66a4c122 Fix test_reasoning_effort_dict_format_gemini_3 2026-02-19 22:14:20 +05:30
michelligabriele 053ee4826f fix(websearch_interception): fix pre_call_deployment_hook not triggering via proxy router (#21433)
* fix(websearch_interception): fix pre_call_deployment_hook not triggering via proxy router

Fix provider lookup (check top-level kwargs + fallback to get_llm_provider),
return full kwargs dict instead of partial, and use OpenAI-format tool definition.

* remove unnecessary inline import
2026-02-19 06:38:45 -08:00
Sameer Kankute ca34e9a3f9 Merge pull request #21543 from BerriAI/litellm_passthrough_endpoint_method
Add method based routing for passthrough endpoints
2026-02-19 19:34:04 +05:30
Sameer Kankute f2393fc9cb Merge main into litellm_passthrough_endpoint_method
Resolved conflicts in pass_through_endpoints.py by:
- Accepting main's formatting and mypy fixes
- Preserving branch's method support feature
- Preserving branch's default_query_params feature

Combined changes include:
- Method filtering for passthrough endpoints
- Default query parameters support
- Updated route key format to include methods
- Code formatting improvements from main
- Fixed type annotations

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-19 19:22:41 +05:30
Sameer Kankute 647e5237a7 Merge pull request #21555 from BerriAI/litellm_server_side_compaction_trans
[Feat] Add server side compaction translation from openai to anthropic
2026-02-19 19:14:37 +05:30
Sameer Kankute 8bcca905a7 Merge pull request #21539 from BerriAI/litellm_fix_azure_store_param
Fix: add stop param as supported for openai and azure
2026-02-19 19:12:43 +05:30
Sameer Kankute 1ad9d26c6f Merge pull request #21559 from BerriAI/fix_openai/bge-multilingual-gemma2
Fix usage in xai
2026-02-19 19:07:09 +05:30
Sameer Kankute 308cdb2720 Merge pull request #21557 from SherifWaly/sherif.waly/add-reasoning-multi-turn-hosted-vllm
Convert thinking_blocks to content blocks for hosted_vllm multi-turn
2026-02-19 18:56:09 +05:30
Sameer Kankute fc7fa73b6f Fix usage in xai 2026-02-19 18:48:30 +05:30
Sameer Kankute 0bea9c1dbc Merge pull request #21497 from SolitudePy/fix/github-provider-match-openai-metadata
fix: allow github aliases to reuse upstream model metadata
2026-02-19 18:30:33 +05:30
Sameer Kankute ea8c8ebc05 Merge pull request #21547 from ZeroAurora/remove-dashscope-str-transformation
fix: remove list-to-str transformation from dashscope
2026-02-19 18:20:06 +05:30
sherif.waly 5774c845d8 Convert thinking_blocks to content blocks for hosted_vllm multi-turn
For multi-turn conversations, convert thinking_blocks on assistant
messages into content blocks prepended before the rest of the content,
so reasoning context is passed back to the hosted_vllm API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-19 12:25:18 +00:00