Commit graph

34410 commits

Author SHA1 Message Date
Sameer Kankute
82025bff6e Fix code qa 2026-02-26 12:47:52 +05:30
Sameer Kankute
0debe92605 Fix_mapped tests part 2 2026-02-26 12:43:39 +05:30
Sameer Kankute
9c7f8138e1 FIx : litellm/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py 2026-02-26 12:43:06 +05:30
Sameer Kankute
7cda0e4edd Fix code qa 2026-02-26 12:43:06 +05:30
Sameer Kankute
9bf369d53b Fix : enterprise tests 2026-02-26 12:43:05 +05:30
Sameer Kankute
5e63969ed7
Merge branch 'main' into litellm_fix_cicd_26_02 2026-02-26 12:14:49 +05:30
Sameer Kankute
a54cf53ffb Fix test_standard_logging_payload_includes_guardrail_information 2026-02-26 12:13:26 +05:30
Sameer Kankute
f34b0366a3 Fix: test_gaurdrails* 2026-02-26 12:10:49 +05:30
Sameer Kankute
af3b6f3334 Fix: litellm/tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py 2026-02-26 12:09:42 +05:30
Sameer Kankute
2d231c2f1a Fix code qa 2026-02-26 12:08:40 +05:30
yuneng-jiang
ac3cfff93f Merge remote-tracking branch 'origin' into litellm_paginated_key_alias 2026-02-25 22:32:36 -08:00
yuneng-jiang
8192819bda
Merge pull request #22158 from BerriAI/ui_build_fix_51
[Infra] Fixing UI Build
2026-02-25 22:30:13 -08:00
yuneng-jiang
5a123f0e75 fixing ui build 2026-02-25 22:29:34 -08:00
yuneng-jiang
701ec62da6 [Feature] UI - Paginated Key Alias Select
Replace the non-paginated Key Alias filter with a new PaginatedKeyAliasSelect component that mirrors the existing PaginatedModelSelect pattern. This aligns the UI with the paginated /key/aliases endpoint from PR #22137.

Changes:
- Added useInfiniteKeyAliases hook for paginated key alias fetching
- Created PaginatedKeyAliasSelect component with infinite scroll (80% threshold)
- Updated keyAliasesCall in networking to accept page/size/search params
- Replaced Key Alias filter in Request Logs and Virtual Keys tables to use customComponent
- Removed fetchAllKeyAliases helper and related upfront fetching logic
- Added 22 tests for new component and hook; all existing tests pass (54 tests)

Fixes the issue where the UI was fetching all key aliases at once, causing performance issues with large key sets.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-25 22:21:32 -08:00
Harshit Jain
218383f739
fix: req changes 2026-02-26 11:45:28 +05:30
Ishaan Jaff
f1c9cb7e71
feat(vertex_ai): Vertex AI Gemini Live via unified /realtime endpoint (#22153)
* feat(vertex_ai): add Vertex AI Gemini Live support via unified /realtime endpoint

Adds VertexAIRealtimeConfig which translates the OpenAI Realtime WebSocket
protocol to Vertex AI BidiGenerateContent. Supports voice in/voice out
(16 kHz mic → 24 kHz speaker) and text in/text out through the proxy's
/realtime endpoint.

Key changes:
- New litellm/llms/vertex_ai/realtime/transformation.py with VertexAIRealtimeConfig
  - Builds correct wss:// URL (regional + global)
  - OAuth2 Bearer token auth (not API key)
  - Full model path (projects/.../publishers/google/models/...)
  - Ignores session.update (Vertex AI only accepts one setup message)
- realtime_api/main.py: vertex_ai branch resolves OAuth token + constructs config
- llm_http_handler.py: auto-sends session setup before bidirectional_forward
- gemini/realtime/transformation.py: fix crashes on empty turnComplete events
- realtime_streaming.py: try/except guard so bad messages don't kill the loop
- proxy_server.py: add missing websockets.exceptions import

* docs: add vertex_realtime to sidebars

* fix: drop unknown event types in Gemini transform; add vertex_ai health check

* fix: propagate UUID fallback IDs from transform_content_done_event to return_additional_content_done_events

* fix: route guardrail backend sends through provider transform; fix str.strip misuse for model prefix

* fix: handle Vertex AI full resource path in session.created; route guardrail block sends through _send_to_backend

* fix: remove unused VertexBase in transformation.py; apply UUID fallback in return_additional_content_done_events
2026-02-25 22:11:06 -08:00
Krish Dholakia
a9cb2674c0
feat(add-new-block_code_execution-guardrail): prevent agent from executing code (#22154)
Adds a new block_code_execution guardrail that detects markdown fenced code blocks
in request/response content and blocks or masks them by language. Includes full
UI integration, type definitions, compliance test dataset, and 26 unit tests.

Key guardrail capabilities:
- Regex-based fenced code block detection with configurable blocked languages
- Confidence scoring with tunable threshold
- Execution-intent heuristics (request-side only) with conflict resolution
- Block or mask actions for detected code
- Support for pre_call, post_call, and during_call event hooks

Security hardening:
- Response-side blocking skips intent heuristics (LLM output doesn't contain
  user intent phrases, so checking would silently disable post_call blocking)
- No-execution short-circuit includes conflict resolution: if both no-execution
  and execution phrases match, execution intent wins
- Tightened overly broad phrases to prevent trivial bypass
- _normalize_escaped_newlines only applies to pure-escaped payloads to avoid
  corrupting content that discusses escape sequences

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 22:02:14 -08:00
Harshit Jain
e09a571a8b
Merge branch 'litellm_feat_datadog_metrics' of https://github.com/Harshit28j/litellm into litellm_feat_datadog_metrics 2026-02-26 11:31:00 +05:30
Harshit Jain
94be31a816
fix req changes 2026-02-26 11:30:33 +05:30
Sameer Kankute
f1080a7e30 Add 'image_url; to both if the intent is to support it in assistant messages 2026-02-26 11:29:34 +05:30
yuneng-jiang
386c148b8d use raw SQL in key_aliases to avoid loading full rows into memory
Replace Prisma ORM count/find_many calls with two query_raw calls that
only project the key_alias column. The Prisma client wrapper does not
support SELECT projection via find_many, so raw SQL is used to keep
memory usage proportional to the page size rather than total key count.
Update tests to mock query_raw instead of count/find_many.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-25 21:48:53 -08:00
Sameer Kankute
d751fdc900 add ChatCompletionImageObject in OpenAIChatCompletionAssistantMessage 2026-02-26 11:13:26 +05:30
yuneng-jiang
06e87eea87 remove unsupported select param from find_many call
LiteLLM_VerificationTokenActions.find_many() does not support the
select keyword argument. Remove it and drop the corresponding test.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-25 21:40:56 -08:00
Ishaan Jaff
82cd14ea1d
feat(realtime): guardrails support for /v1/realtime WebSocket endpoint (#22152)
* feat(realtime): add guardrails query param to /v1/realtime WebSocket endpoint

- Add 'guardrails' query param (comma-separated) to realtime_websocket_endpoint
- Import websockets and websockets.exceptions at module level (fixes NameError in except clause)
- Split try/except into Phase 1 (pre-call) and Phase 2 (routing) so guardrail
  errors send back a typed error event before closing, while upstream errors
  close silently with 1011

* feat(ui): pass selectedGuardrails from sidebar to RealtimePlayground WebSocket URL

* docs(realtime): add guardrails section with dynamic passing examples
2026-02-25 21:34:22 -08:00
Sameer Kankute
f8e0b37769 FIx test_read_request* 2026-02-26 10:54:17 +05:30
Sameer Kankute
2349b51d80 Fix test_pass_through_request_logging_failure 2026-02-26 10:50:05 +05:30
Sameer Kankute
827bb2f535 Fix: test_sentence[te_6] 2026-02-26 10:48:52 +05:30
Sameer Kankute
828ce40eac Fix test_async_gcs_pub_sub_v1 2026-02-26 10:46:01 +05:30
Sameer Kankute
8f439c96ee Fix UI build 2026-02-26 10:43:59 +05:30
Sameer Kankute
552d9aa792 Fix code qa for _types.py 2026-02-26 10:43:39 +05:30
Sameer Kankute
f68cbc4c95 Fix test_perform_health_check_filters_by_model_id 2026-02-26 10:43:05 +05:30
Sameer Kankute
3326893420 Fix mypy issues 2026-02-26 10:42:01 +05:30
yuneng-jiang
0b0809a3d5 optimize key_aliases to select only key_alias column and add unit tests
Add select={"key_alias": True} to the find_many call so only the alias
column is fetched from the database instead of full token rows. Add
five unit tests in test_key_management_endpoints.py covering response
shape, pagination skip/take computation, search filter injection,
absence of contains filter when no search term is given, and the
select-only-alias optimization.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-25 21:03:15 -08:00
Sameer Kankute
573969a703
Merge pull request #22139 from BerriAI/litellm_fix_aiml_pricing
[Chore] Update aiml model pricing
2026-02-26 10:06:51 +05:30
Sameer Kankute
3634b5fda0 Remove logger 2026-02-26 10:02:29 +05:30
Sameer Kankute
691927f9c9 fix(embeddings): allow dimensions param passthrough via allowed_openai_params for non-text-embedding-3 OpenAI models
When calling non-text-embedding-3 models routed through the openai provider
(e.g. nvidia/llama-3.2-nv-embedqa-1b-v2), passing `dimensions` previously
raised an UnsupportedParamsError unconditionally. This fix threads
`allowed_openai_params` through the embedding call stack so that providers
can opt-in to passing `dimensions` by including it in the list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 09:59:37 +05:30
Sameer Kankute
48f549b30b Return Clear error message why no tools are available / IP Filtering occured 2026-02-26 09:56:44 +05:30
Sameer Kankute
c845bdc5c8 [Chore] Update aiml model pricing 2026-02-26 08:53:57 +05:30
Sameer Kankute
f78104d34c
Merge pull request #22114 from cu-aaii/2026-02-25-azure-openai-updates
New Azure OpenAI Models 2026-02-25
2026-02-26 08:02:47 +05:30
Krish Dholakia
c2c8870d2d
Add claims agent guardrails (5 categories + policy template) (#22113)
* Add claims agent guardrails with 243-case eval dataset

5 new category guardrails for healthcare claims agent chatbots:
- claims_fraud_coaching: fraud coaching, exaggeration, document forgery
- claims_phi_disclosure: unauthorized PHI access, bulk data extraction
- claims_prior_auth_gaming: code manipulation, medical necessity misrepresentation
- claims_system_override: system injection, rule bypass, role impersonation
- claims_medical_advice: medical advice (claims-context-aware)

Plus claims_agent_safety.yaml policy template combining all 5.

All 5 eval suites pass at 100% precision/recall/F1 (243 test cases).

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

* Add claims agent chatbot safety policy template

Combines the 5 claims guardrails into a single deployable policy template:
fraud coaching, PHI disclosure, prior-auth gaming, system override, and medical advice.

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

* Add guardrail benchmark results and UI compliance prompts

Adds benchmark results for claims, discrimination, and content filter guardrails.
Updates UI compliance prompt data.

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

* Remove duplicate "file an appeal" exception in claims_prior_auth_gaming.yaml

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

* Remove unused claims_agent_safety.yaml policy template

The claims-agent-safety template in policy_templates.json references
individual category files in categories/, not this combined file.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:09:38 -08:00
yuneng-jiang
4643685e78 [Fix] /key/aliases: Add pagination and search to prevent OOMs
The /key/aliases endpoint previously fetched all key aliases from the database without limit, causing OOM crashes with large key sets. Added page, size, and search query parameters with database-level filtering to enable paginated and searchable key alias retrieval. Updated the response to include pagination metadata (total_count, current_page, total_pages, size) matching the /v2/model/info pattern.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-25 17:55:26 -08:00
Ryan Crabbe
a0578a29f1 fix: dup assignment, os.environ setting 2026-02-25 17:45:13 -08:00
Ryan Crabbe
e988867480 wip redundant code 2026-02-25 17:43:45 -08:00
Ryan Crabbe
280464412d clean up docstring 2026-02-25 17:33:44 -08:00
Ryan Crabbe
bfceefbb26 parameterize test 2026-02-25 17:30:59 -08:00
Ryan Crabbe
9157c1ebe2 test: redundant tests 2026-02-25 17:29:17 -08:00
Ryan Crabbe
9ea100a9f7 feat: add prometheus multiprocess directory cleanup
Adds cleanup utilities for PROMETHEUS_MULTIPROC_DIR to prevent
unbounded RAM/disk growth from stale .db files in multi-worker setups.

Three-part lifecycle aligned with upstream prometheus_client docs:
1. Startup: wipe entire directory before workers fork (clean slate)
2. Shutdown: mark_process_dead() for own PID (removes gauge_live* only)
3. Periodic (hourly): scan for dead PIDs and call mark_process_dead()

Counter/histogram files are never individually deleted at runtime to
avoid partial counter resets that cause false spikes in rate()/increase().

Also auto-creates PROMETHEUS_MULTIPROC_DIR when prometheus callback is
configured with multiple workers and the env var is not already set.
2026-02-25 17:20:46 -08:00
Steve G
9806e21871
Add Lakera v2 post-call hook and tests (fixed PII masking) (#21783)
* Add post-call hook for Lakera guardrail and mask PII in responses

* Add post-call hook for Lakera and mask PII in responses

* Fix post-call hook: pass event_type to call_v2_guard

* Address Greptile review: return ModelResponse, fix mutation, add header, test location, mask order

- PII masking path: return ModelResponse instead of dict so deployment hook accepts it
- Avoid mutating request data: deep copy original_messages and messages in _mask_pii_in_messages
- Add guardrail header in PII-only return path
- Add test in tests/test_litellm/ (test_lakera_ai_v2.py) per PR checklist
- Sort PII payload spans by (start,end) descending so multiple spans in one message mask correctly

Co-authored-by: Cursor <cursoragent@cursor.com>

* Updated ponteital for index mismatch when choices have null content and inconsistent on_flagged access pattern

* Update litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Update to explicitly state supported endpoints - chat completions

* Fix minor lint error on masked_entity_count

---------

Co-authored-by: Steve <steve.giguere@lakera.ai>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-25 17:20:38 -08:00
yuneng-jiang
88bf8de3cf
Merge pull request #22119 from BerriAI/litellm_ui_mcp_auth_non_req
[Fix] UI - MCP Servers: Make auth value optional for create flow
2026-02-25 16:48:08 -08:00
yuneng-jiang
6ac3ed6b4e
Merge pull request #22122 from BerriAI/litellm_ui_spend_logs_duration
[Feature] UI - Logs: Use backend request_duration_ms and make Duration sortable
2026-02-25 16:47:22 -08:00