Commit graph

33248 commits

Author SHA1 Message Date
Sameer Kankute
3087f6080a
Merge pull request #21299 from BerriAI/litellm_add_remaining_beta_tests2
[Chore]Add remaining beta tests2
2026-02-18 18:11:54 +05:30
Julio Quinteros Pro
30d4f344ae fix(tests): restore proxy_server module attrs in test_proxy_admin_expired_key_from_cache
The test was using setattr() to set module-level attributes (including
proxy_logging_obj = MagicMock()) on the real litellm.proxy.proxy_server
module, but the finally block only had `pass` — no cleanup.

This left proxy_logging_obj as a MagicMock in subsequent tests running
in the same pytest-xdist worker, causing TypeError when log_db_metrics
decorator called asyncio.create_task(proxy_logging_obj.service_logging_obj
.async_service_success_hook(...)) — a MagicMock is not a coroutine.

Fix: save original attribute values before the test and restore them in
the finally block to ensure test isolation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 09:33:11 -03:00
Sameer Kankute
aa255c7e63
Merge pull request #21361 from BerriAI/litellm_oss_staging_02_17_2026
Litellm oss staging 02 17 2026
2026-02-18 17:48:15 +05:30
Sameer Kankute
bd0c80406f
Merge pull request #21326 from BerriAI/litellm_oss_staging_02_16_2026
Litellm oss staging 02 16 2026
2026-02-18 17:47:57 +05:30
Harshit Jain
02e4530bfe
fix: add missing var in standard logging metadata 2026-02-18 17:47:31 +05:30
Sameer Kankute
4bbd15fe41 Fix test_async_post_call_success_hook_includes_client_ip_user_agent 2026-02-18 17:37:23 +05:30
Sameer Kankute
7e36d47348 fix code quality tests and mypy 2026-02-18 17:36:36 +05:30
Sameer Kankute
6a42e997ec
Merge pull request #21469 from BerriAI/revert-21226-fix/pod-lock-atomic-release-delete
Revert "fix: make PodLockManager.release_lock atomic compare-and-delete"
2026-02-18 17:26:43 +05:30
Sameer Kankute
eb8b991260
Merge branch 'main' into litellm_oss_staging_02_17_2026 2026-02-18 17:26:33 +05:30
Sameer Kankute
0e79326c81 Fix cicd tests 2026-02-18 17:25:28 +05:30
Sameer Kankute
53dcebc37a
Revert "fix(pod-lock): make release lock compare-and-delete atomic (#21226)"
This reverts commit f162371b93.
2026-02-18 17:24:34 +05:30
Julio Quinteros Pro
d44d52f1e3 fix(test): correct assertion order in test_case_a_orphaned_tool_call_multiple
The implementation correctly preserves tool_call order: existing results first
(call_1), then dummy results for missing ones (call_2). The test was asserting
the reverse order with incorrect comments. Fix the assertions to match the
actual correct behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 08:25:33 -03:00
Julio Quinteros Pro
dc003e2a94 fix: prevent sys.modules["langfuse"] import failures in langfuse unit tests
Three test failures caused by the real langfuse SDK import being triggered
at test time:

1. test_langfuse_prompt_management.py: Both tests create LangfusePromptManagement()
   which calls `import langfuse`. Since earlier TestLangfuseUsageDetails tests
   remove sys.modules["langfuse"] via patch.dict teardown, the real langfuse
   import runs and fails on Python 3.14 (pydantic v1 incompatibility).
   Fix: add setup_method/teardown_method to mock sys.modules["langfuse"].

2. test_langfuse.py::test_max_langfuse_clients_limit: Same root cause — creates
   LangFuseLogger() without mocking sys.modules["langfuse"].
   Fix: wrap test body with patch.dict("sys.modules", {"langfuse": mock}).

3. test_langfuse_otel.py::test_extract_langfuse_metadata_with_header_enrichment:
   Replaces sys.modules["litellm.integrations.langfuse.langfuse"] with a stub
   without restoring it, causing patch() in later tests to target the stub
   instead of the real module.
   Fix: use monkeypatch.setitem() which auto-restores after the test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 08:22:23 -03:00
Julio Quinteros Pro
77d1f6932e fix(test): restore default_internal_user_params to None instead of delattr
test_role_mappings_override_default_internal_user_params was calling
delattr(litellm, 'default_internal_user_params') in its finally block
when the original value was None. This removes the attribute entirely from
the module, causing subsequent tests in the same xdist worker to get
AttributeError when accessing litellm.default_internal_user_params (because
litellm.__getattr__ has no handler for this name).

Fix: always restore the attribute by assignment (litellm.default_internal_user_params = original_default_params)
rather than deleting it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 08:18:13 -03:00
Sameer Kankute
9678c723b0 Add reasoning' field to 'reasoning_content' field in delta 2026-02-18 16:47:05 +05:30
Harshit Jain
78e6080ed7
Merge branch 'main' of https://github.com/BerriAI/litellm into litellm_feat_dataDog_tags 2026-02-18 16:29:01 +05:30
Harshit Jain
3ea8d32d81
Merge pull request #21402 from Harshit28j/litellm_prompt_registry_fix
Litellm prompt registry fix
2026-02-18 16:27:56 +05:30
Sameer Kankute
3bc1ae5331 Add duckcukgo in docs 2026-02-18 16:21:41 +05:30
Sameer Kankute
6b8b391116 Add duckcukgo in docs 2026-02-18 16:17:39 +05:30
Sameer Kankute
0ea8249e96 Add duckcukgo in model map 2026-02-18 16:13:20 +05:30
Sameer Kankute
fae95eee88 Add duckduckgo as search tool 2026-02-18 15:55:14 +05:30
Sameer Kankute
cfea7580e3
Merge pull request #21460 from TomeHirata/databricks/responses-api
Add native Responses API support for Databricks GPT models
2026-02-18 13:34:18 +05:30
Sameer Kankute
6b26b47cd4 Add mapping for websearch from v1/messages to chat/completions 2026-02-18 13:32:25 +05:30
Sameer Kankute
838bfc8616 Fix greptile review 2026-02-18 13:07:58 +05:30
Sameer Kankute
075bf74abb Remove double import 2026-02-18 12:47:10 +05:30
Sameer Kankute
ec4fae59c2 Potential fix for code scanning alert no. 3990: Clear-text logging of sensitive information
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-02-18 12:44:55 +05:30
Sameer Kankute
eebe23197f Add docs for message sanitisation 2026-02-18 12:44:48 +05:30
Sameer Kankute
9a3c0dcb90 Add sanititzation for anthropic messages 2026-02-18 12:44:48 +05:30
YutaSaito
91c3746771 feat: contextual gap checks, word-form digits (#18301)
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-02-18 12:44:03 +05:30
ryanh-ai
8e8511a2a3
feat(bedrock): support nova/ and nova-2/ spec prefixes for custom imported models (#21359)
Add routing prefixes bedrock/nova/<ARN> and bedrock/nova-2/<ARN> so
LiteLLM can identify the base model family for custom/imported Nova
models and enable the correct supported params (tools, web_search,
reasoning_effort).

Changes:
- Route nova/ and nova-2/ prefixed models to converse API
- Strip spec prefix before sending ARN to Bedrock
- Return sentinel base models (amazon.nova-custom, amazon.nova-2-custom)
  so downstream Nova checks work
- Recognize nova-2/ prefix in _is_nova_2_model() for reasoning support
- Handle nova/nova-2 in get_bedrock_model_id() for proper ARN encoding
- Add unit tests for all new behavior
2026-02-17 23:00:37 -08:00
Tomu Hirata
020d769930 Address Greptile review: fix SDK auth fallback and remove unused imports
- Use custom_endpoint=False so Databricks SDK auth fallback works
  (custom_endpoint=True was blocking it). The api_base returned by
  databricks_validate_environment is discarded since get_complete_url
  builds the URL separately.
- Remove unused verbose_logger import
- Remove unused json import in tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:57:50 +09:00
Eloy Lafuente
d04612229d
Add support for devstral 2512 model aliases (#21372)
- labs-devstral-small-2512 supports devstral-small-latest
- devstral-2512 supports devstral-latest and devstral-medium-latest

The information is available in the models page (source field). Have
checked the prices and they match.

Other mistral models (codestral, magistral, ...) already have
the aliases in the database.

Final note: I've created #21328 to propose the creation of some
support for these aliasing cases. To have to dupe the entries is
prone to errors and hard to maintain, when there are model version
bumps.
2026-02-17 22:56:51 -08:00
Krish Dholakia
14a35a12cb
Revert "End users - Allow giving end users access to specific mcp servers (#…" (#21461)
This reverts commit 1f521be0f2.
2026-02-17 22:49:57 -08:00
Sameer Kankute
03f5717456 Fixes based on greptile reviews 2026-02-18 12:19:11 +05:30
Krish Dholakia
1f521be0f2
End users - Allow giving end users access to specific mcp servers (#21411)
* feat(schema.prisma): add object permissions for end users

allows controlling if end user can call specific mcp servers

* feat: cleanup for customer_endpoints support of object permission id

* fix: cleanup str

* feat(customers/): enforce end user can only call allowed mcps - if configured

* docs: document customer/end user object permission usage

* feat: address greptile comments
2026-02-17 22:45:49 -08:00
Tomu Hirata
fe7e764846 Add native Responses API support for Databricks GPT models
Databricks supports the Responses API natively for GPT models, but litellm
was falling back to the completion transformation handler which converts
responses requests to chat completion calls, losing response schema enforcement.

This adds DatabricksResponsesAPIConfig that passes responses API requests
directly to Databricks' /responses endpoint for GPT models, while non-GPT
models (Claude, Llama, etc.) continue using the completion transformation path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:34:18 +09:00
Sameer Kankute
9f5580fddd Fixes based on greptile reviews 2026-02-18 11:55:06 +05:30
Sameer Kankute
8f80b1085e Add File deletion criteria with batch references 2026-02-18 11:39:32 +05:30
Ishaan Jaff
371cabfebd
Add MCP Security guardrail to block unregistered MCP servers (#21429)
* Add MCP_SECURITY enum to SupportedGuardrailIntegrations

* Add MCP security guardrail initializer

* Add MCPSecurityGuardrail implementation

* Add MCP Security policy template

* Add Type filter to policy templates UI

* Add unit tests for MCP security guardrail

* fix(lint): remove unused Dict import from mcp_security_guardrail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add French language support for EU AI Act Article 5 guardrail (#21427)

* Add French language support for EU AI Act Article 5 template

- Create eu_ai_act_article5_fr.yaml with comprehensive French keywords
- Includes identifier words: concevoir, créer, développer, noter, classer, etc.
- Includes block words: crédit social, comportement social, émotion des employés, etc.
- Includes always-block keywords for explicit prohibited practices
- Includes exceptions for research, compliance, and legitimate use cases
- Catches circumvention attempts with phrase variations

* Add comprehensive tests for French EU AI Act guardrail

- Test 3 critical scenarios: blocked query, circumvention attempt, safe query
- Test edge cases: case-insensitive, mixed language, research exceptions
- All 7 tests passing
- Validates both blocking and allowing behavior

* Fix content filter to support conditional matching without inherit_from

- Enable conditional matching when identifier_words + additional_block_words are present
- Previously required inherit_from, but EU AI Act templates are self-contained
- Fixes Greptile feedback: conditional matching now works as documented

* Add pure conditional matching test for French guardrail

- Test identifier + block word combinations not in always_block_keywords
- Verifies conditional matching works independently
- Addresses Greptile feedback about test coverage gap

* Fix exception word bypass risk in French template

- Replace short words (film, jeu, juste) with context-specific phrases
- Prevents substring matching bypasses (e.g., enjeu matching jeu)
- Add tests for bypass prevention and legitimate game context
- Addresses Greptile security feedback

* Make conditional match assertion more robust

- Use getattr to safely access exception detail field
- Check if detail is dict before calling .get()
- Addresses Greptile feedback about brittle string assertion

* Add French EU AI Act Article 5 policy template to registry

- Add eu-ai-act-article5-fr template for French language support
- Includes French description and guardrail info
- Matches structure of English template

* Address greptile review feedback (greploop iteration 1)

- Use status_code=400 instead of 403 to match guardrail logging convention
- Use prefix stripping instead of split('/')[-1] for robust server name extraction

* remove French EU AI Act template from policy_templates.json

---------

Co-authored-by: Julio Quinteros Pro <jquinter@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-17 21:19:13 -08:00
Ishaan Jaff
5b5306a540
feat: split EU AI Act Article 5 into 5 dedicated sub-guardrails per language (#21453)
Break the monolithic EU AI Act Article 5 policy template into 5 focused
sub-guardrails, each covering a specific prohibited practice:

- Art. 5.1(a) — Subliminal Manipulation & Deceptive Techniques
- Art. 5.1(b) — Exploitation of Vulnerabilities (children, elderly, disabled)
- Art. 5.1(c) — Social Scoring Systems
- Art. 5.1(f) — Emotion Recognition in Workplace & Education
- Art. 5.1(d)(g)(h) — Biometric Categorization & Predictive Profiling

Each sub-guardrail has expanded keyword coverage specific to its domain.
Includes both English and French versions (10 total sub-guardrails).
Original monolithic YAML files preserved for backward compatibility.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 20:43:25 -08:00
Ishaan Jaff
bc7fef6fda
Add prompt injection detection policy template + guardrails (#21452)
* add SQL injection detection guardrail category

* add malicious code injection detection guardrail category

* add system prompt extraction detection guardrail category

* add jailbreak attempt detection guardrail category

* add data exfiltration detection guardrail category

* add prompt injection detection policy template
2026-02-17 20:31:39 -08:00
Harshit Jain
954e8d25c6
Add relevant test case 2026-02-18 09:31:44 +05:30
Harshit Jain
8d7f9a5e78
feat(datadog): add 'team' tag to logs, metrics, and cost management 2026-02-18 09:24:08 +05:30
Sameer Kankute
e0b28a1a2f Add other provider feats 2026-02-18 09:09:08 +05:30
Sameer Kankute
892b9aca30 Add other provider feats 2026-02-18 09:07:44 +05:30
Sameer Kankute
bdba316a0e Add inference_geo: us costing 2026-02-18 08:57:28 +05:30
Sameer Kankute
0cb56c97a5 Add mapping for thinking and response format 2026-02-18 08:48:29 +05:30
Sameer Kankute
2bbae68685 Add sonnet-4.6 for tool use 2026-02-18 08:43:20 +05:30
Sameer Kankute
8003aa2057
Merge pull request #21358 from ryanh-ai/fix/nova-2-reasoning
fix(bedrock): broaden Nova 2 model detection to support all nova-2-* variants
2026-02-18 08:04:13 +05:30
Ishaan Jaff
5946a933a0
Add compliance checker endpoints + UI panel (#21432)
* eu_ai_act_article5_prohibited_practices_fr

* add backend for checkers

* test checker

* checkEuAiActCompliance

* register compliance router in proxy_server.py

* add compliance check functions to networking.tsx

* fix useEffect dependency array in CompliancePanel

* ui fixes
2026-02-17 18:22:26 -08:00