Commit graph

33245 commits

Author SHA1 Message Date
yuneng-jiang
14e8af94a9 feat: add reusable MemberTable AntD component
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 21:41:53 -08:00
yuneng-jiang
b61537cd0f feat: expose user_email in organization members response
Add user_email field to LiteLLM_OrganizationMembershipTable with a model_validator
that populates it from the nested user object, and update the /organization/info
Prisma query to select user_email from the related user record.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 21:41:53 -08:00
Harshit Jain
80c3b236e2
Update docs/my-website/docs/troubleshoot/rollback.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-21 10:40:41 +05:30
Harshit Jain
5916cf15ad
Update docs/my-website/docs/troubleshoot/rollback.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-21 10:40:31 +05:30
Harshit Jain
ece5b8c565
doc: add rollback safety check 2026-02-21 10:33:17 +05:30
yuneng-jiang
36efd5384e
Merge pull request #21739 from BerriAI/litellm_credential_tag_prefix
[Feature] UI - Usage: Prefix credential tags, update Tag usage banner
2026-02-20 21:00:16 -08:00
yuneng-jiang
9f3e20510d feat(usage): prefix credential tags and update Usage page banners
- Prefix credential name tags with "Credential: " to distinguish them
  from user-defined tags when litellm_credential_name is injected
- Remove stale "new feature" banners from Organization, Customer, and
  A2A usage views
- Add closable info banner to Tag usage view noting that reusable
  credentials are automatically tracked and appear as "Credential: <name>"
2026-02-20 20:55:57 -08:00
yuneng-jiang
b7efca22a2
Merge pull request #21723 from BerriAI/litellm_fix_cost_token_masking
[Fix] Model Info: input_cost_per_token masked in UI
2026-02-20 20:36:22 -08:00
yuneng-jiang
8767b8f886
Merge pull request #21721 from BerriAI/litellm_suppress_dashboard_team_warn
[Fix] Suppress warning for litellm-dashboard team in agent permission handler
2026-02-20 20:36:09 -08:00
Ishaan Jaff
8e2aeeae0b
feat(ui): Guardrail Garden - guardrail marketplace (#21732)
* feat(ui): add Guardrail Garden page with Vertex-style card layout

* feat(ui): add guardrail garden preset configs for form pre-fill

* feat(ui): add Guardrail Garden as first tab on guardrails page

* feat(ui): support preset prop in AddGuardrailForm for garden pre-fill

* fix(ui): fix merge syntax error in ComplianceUI

* refactor(ui): split guardrail_garden.tsx into focused modules
2026-02-20 19:47:04 -08:00
Krish Dholakia
0888e17272
fix: ui fixes (#21731) 2026-02-20 19:29:55 -08:00
Ishaan Jaff
08520a9ed7
feat: add insults content filter + topic blocking compliance UI (#21729)
* add denied_insults.yaml content filter category

* add block_insults.csv eval set (299 cases)

* add block_insults.jsonl eval set (299 cases)

* add insults eval results (100% F1)

* add TestInsultsContentFilter eval class

* add generate_compliance_prompts.py script

* add insultsCompliancePrompts.ts (299 prompts from CSV)

* add financialCompliancePrompts.ts (207 prompts from CSV)

* add Topic Blocking framework to compliance playground UI
2026-02-20 19:10:31 -08:00
Krish Dholakia
e8d0afd7cb
Guardrail - competitor name blocker (#21719)
* feat: add competitor name blocker guardrail

* fix: fix batch test endpoint for compliance playground

* fix(airline.py): add list of all known airlines to airline competitor name detector

prevent competitor discussion on company chatbot

* feat: ui tweaks for prod
2026-02-20 18:52:40 -08:00
Ishaan Jaff
c61dea5af9
UI: Redesign guardrail creation form with vertical stepper (#21727)
* ui: redesign guardrail creation form with inline vertical stepper

Replace horizontal Ant Design Steps with an inline vertical stepper.
Completed steps collapse to a single line, active step expands.
Switch to Tremor buttons, rename steps for clarity.

* ui: rename Content Categories to Blocked topics and fix overflow

Update heading and description text, add flexWrap to prevent
text from going off-screen, fix YAML preview overflow with
pre-wrap and word-break.

* feat: support explicit display_name in content filter category YAML

Check for a display_name field before auto-generating from
category_name. Lets categories have human-friendly names
without changing their API identifier.

* fix: update denied_financial_advice display name

Add display_name field so it shows as
"Denied Financial / Investment Advice" in the UI.
2026-02-20 18:42:11 -08:00
yuneng-jiang
9eb61a9a56 fix: use UI_TEAM_ID constant instead of hardcoded string
Replace hardcoded "litellm-dashboard" string with the existing UI_TEAM_ID
constant from litellm.proxy._types to avoid duplication.
2026-02-20 18:14:57 -08:00
yuneng-jiang
65961988cb
Update litellm/proxy/agent_endpoints/auth/agent_permission_handler.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-20 18:13:50 -08:00
yuneng-jiang
ac7446bb76 fix: don't mask cost_per_token fields in SensitiveDataMasker
Fields like input_cost_per_token contain "token" as a key segment,
which incorrectly matched the sensitive patterns list and caused values
like 3.6e-06 to be displayed as "3.60*******e-06" in the model info UI.

Add a non_sensitive_overrides set (defaulting to {"cost"}) so that any
key containing "cost" as a segment is never masked, regardless of other
matching patterns.
2026-02-20 18:13:27 -08:00
Ishaan Jaff
e0129710c8
fix(proxy): self-heal Prisma connection for auth and runtime (#21706)
* fix(proxy): add prisma reconnect primitive and db watchdog

* fix(proxy): start and stop prisma watchdog in lifecycle

* fix(auth): retry key lookup once after prisma reconnect

* test(proxy): add prisma self-heal watchdog coverage

* test(auth): cover reconnect-once behavior for key lookup

* refactor(auth): extract db reconnect helper and remove inline import

* fix(proxy): apply reconnect cooldown after attempt and add auth timeout path

* fix(auth): bound reconnect latency on key lookup path

* test(auth): assert reconnect timeout argument in key lookup

* test(proxy): verify reconnect cooldown timestamp set after attempt

* fix(proxy): harden prisma reconnect cycle semantics

* test(proxy): cover watchdog reconnect + timeout budget

* fix(proxy): bound watchdog probe and reconnect paths

* test(proxy): cover watchdog timeout and probe behavior

* fix(proxy): narrow prisma db connection error classification

* fix(proxy): add auth reconnect lock timeout budget

* fix(auth): pass lock timeout for db reconnect retries

* test(proxy): cover narrow prisma connection error detection

* test(proxy): add reconnect lock-timeout behavior coverage

* test(auth): assert reconnect lock timeout argument

* fix(proxy): avoid lock leak race in reconnect lock timeout path

* test(proxy): cover reconnect lock-timeout race cleanup
2026-02-20 18:11:36 -08:00
Ishaan Jaff
5246e64b98
Add topic blocker guardrail with keyword and embedding implementations (#21713)
* Add keyword-based topic blocker implementation

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

* Add embedding-based topic blocker using MiniLM

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

* Add topic blocker package init with exports

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

* Add synthetic engine eval set (34 cases)

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

* Add investment questions eval set (207 cases)

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

* Add engine eval synthetic policy config

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

* Add engine keyword blocker eval results

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

* Add investment keyword blocker eval results

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

* Add investment embedding blocker eval results

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

* Add investment embedding MiniLM eval results

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

* Add investment embedding MPNet eval results (historical)

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

* Add investment TF-IDF eval results (historical)

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

* Add unified eval runner with confusion matrix reporting

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

* Add benchmarks comparison table in markdown

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

* Clean up topic blocker: remove unused blockers, add phrase_patterns to content filter

- Remove embedding_blocker.py, api_embedding_blocker.py, nli_blocker.py,
  tfidf_blocker.py, onnx_blocker.py (heavy deps not in Docker, inferior accuracy)
- Remove airline_off_topic_restriction policy template and its test
- Fix __init__.py to only export DeniedTopic and TopicBlocker (no eager import crash)
- Add phrase_patterns support to ContentFilterGuardrail for regex-based paraphrase detection
- Rewrite denied_financial_advice.yaml with conditional matching (identifier + block word),
  always-block keywords, phrase patterns, and exception phrases
- Clean up test_eval.py: only keyword blocker + content filter tests remain (no network calls)
- All 207 eval cases pass at 100% F1, 0 FP, 0 FN, <0.1ms latency

Addresses all Greptile review comments:
- Eager import crash (embedding deps) → fixed
- Undeclared dependencies → fixed (files deleted)
- lru_cache memory leak → fixed (file deleted)
- Real network calls in tests → fixed (embedding tests removed)
- Unused Dict import → already fixed

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

* Add LLM-as-judge eval and update BENCHMARKS.md

- Add TestInvestmentLlmJudgeGpt4oMini and TestInvestmentLlmJudgeClaude
  test classes that use litellm.completion() to classify messages
- System prompt instructs LLM to act as airline chatbot content moderator
- Tests skip gracefully when API keys aren't set
- Update BENCHMARKS.md with production results table, historical comparison,
  and instructions for running LLM judge evals

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

* Move evals and benchmarks to guardrail_benchmarks folder

Move eval runner, eval data (JSONL), and results from
tests/test_litellm/.../topic_blocker/ into the guardrail implementation
folder at litellm/.../litellm_content_filter/guardrail_benchmarks/.

This keeps benchmarks co-located with the guardrail code they test.

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

* Remove standalone topic_blocker package, consolidate into content_filter

The standalone keyword_blocker.py was redundant with content_filter.py +
denied_financial_advice.yaml. Removed the entire topic_blocker/ package,
engine eval files, and old keyword blocker results. Simplified test_eval.py
to only test ContentFilter + LLM judge baselines.

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

* Fix compliance playground batch scoring bug, add display_name support

The compliance playground was sending all texts in a single batch API call,
but the content filter raises HTTPException on the first blocked text. This
caused a single blocked/allowed result to be applied to all rows, producing
incorrect scores (e.g. 41% instead of 100%). Fix by sending each text
individually to get per-text results with progressive UI updates.

Also add display_name field support for category YAML files so
denied_financial_advice shows as "Denied Financial / Investment Advice"
in the UI dropdown.

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

* Add block_investment CSV eval set and update benchmark result JSON

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

* address greptile review feedback (greploop iteration 1)

Fix stale test path in denied_financial_advice.yaml comment.
Other comments were on files already deleted in prior commits.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:02:04 -08:00
yuneng-jiang
883a8e0589 fix: suppress noisy warning for litellm-dashboard team in agent permission handler
litellm-dashboard is the default UI team and will never have agents registered.
Skip the warning log when get_team_object raises a 404 for this team to avoid
log noise.
2026-02-20 17:57:07 -08:00
ryan-crabbe
5fb0521eff
Merge pull request #21720 from BerriAI/litellm_claude-code-duplicate-detection
feat: route gh actions through litellm
2026-02-20 17:55:57 -08:00
yuneng-jiang
5084fe9538
Merge pull request #21715 from BerriAI/litellm_credential_tag_usage
[Feature] Inject Credential Name as Tag for Usage Page Filtering
2026-02-20 17:51:28 -08:00
Ryan Crabbe
1d0f91010b feat: switch duplicate detection workflows from opencode to Claude Code
Route through LiteLLM proxy using LITELLM_VIRTUAL_KEY and LITELLM_BASE_URL
secrets. Also adds --repo flag to all gh commands to fix missing repo context.
2026-02-20 17:51:12 -08:00
ryan-crabbe
dbff558d96
Merge pull request #21717 from BerriAI/litellm_fix_redis_connection_pool_leaks
fix: redis connection pool reliability
2026-02-20 17:42:48 -08:00
Ryan Crabbe
05d18e60b2 fix: add logging to sync client close failure in disconnect() 2026-02-20 17:36:36 -08:00
Ryan Crabbe
bfeed0e590 fix: also close sync clients on eviction from LLMClientCache 2026-02-20 17:36:28 -08:00
yuneng-jiang
8ea28dde88
Merge pull request #21718 from BerriAI/yj_release_feb20
[Infra]  litellm_release_day_02_19_2026 fixes
2026-02-20 17:35:44 -08:00
Sameer Kankute
01148511fb Fix: litellm/tests/llm_responses_api_testing/test_anthropic_responses_api.py 2026-02-20 17:30:53 -08:00
Sameer Kankute
631400cb17 Fix anthropic responses 2026-02-20 17:30:42 -08:00
Sameer Kankute
4d6b7699cc Fix sonnet 3.7 tests 2026-02-20 17:29:16 -08:00
Sameer Kankute
2bc4c4359d Add supports_web_search for sonnet 4 2026-02-20 17:29:05 -08:00
Sameer Kankute
adb91d442a Fix: test_pass_through_endpoint_bing 2026-02-20 17:28:17 -08:00
Sameer Kankute
61eaf96046 Fix passthrough tests 2026-02-20 17:28:06 -08:00
Sameer Kankute
36fd14357c FIx: replace deprecated claude-3-7-sonnet-20250219 with claude-4-sonnet-20250514 2026-02-20 17:27:59 -08:00
yuneng-jiang
65dc7556a8 [Fix] Fix web search model info regression, deprecated prompt caching model, undocumented env keys
- Revert test_anthropic_web_search_in_model_info to use claude-3-5-haiku-latest
  (model info test doesn't make API calls, so the -latest alias is fine here)
- Replace claude-3-7-sonnet-20250219 with claude-sonnet-4-5-20250929 in
  test_anthropic_prompt_caching.py (10 instances)
- Include pending doc updates for COMPETITOR_LLM_TEMPERATURE and
  MAX_COMPETITOR_NAMES env vars in config_settings.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-20 17:26:58 -08:00
yuneng-jiang
e6b9bef949 [Fix] Fix flaky tests: spend logs metadata keys, proxy CLI isolation, Redis TTL uniqueness
- Add new SpendLogsMetadata keys to ignored_keys in spend logs tests
  (regression from ccecc10c82 which intentionally includes all keys)
- Mock PrismaManager.setup_database and should_update_prisma_schema in
  proxy CLI tests to prevent real DB migrations from running in CI
- Use CliRunner(mix_stderr=False) to fix Click stream lifecycle issues
- Use unique UUID suffix for Redis TTL test keys to avoid stale state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-20 17:26:44 -08:00
yuneng-jiang
5354cb26e1 [Fix] Replace deprecated claude-3-7-sonnet in test_anthropic_completion, add store to OPENAI_CHAT_COMPLETION_PARAMS
Replace claude-3-7-sonnet-20250219 with claude-sonnet-4-5-20250929 in
test_anthropic_completion.py (9 instances). Add missing "store" param
to OPENAI_CHAT_COMPLETION_PARAMS to fix test_store_in_openai_chat_completion_params.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-20 17:26:19 -08:00
yuneng-jiang
c27b65d09e [Fix] Replace deprecated claude-3-7-sonnet-20250219 with claude-sonnet-4-5-20250929 in test_completion
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-20 17:26:02 -08:00
yuneng-jiang
e5619c39a0 [Fix] Update UI tests for GuardrailViewer rewrite and AllModelsTab QueryClient
GuardrailViewer was rewritten from ant-design Collapse to a custom card
layout. Tests now match the new component: updated header text, ms-based
duration, expand-to-reveal provider details, and removed ant-collapse
references.

AllModelsTab tests failed because ModelSettingsModal now uses useMutation
via useStoreModelInDB. Switched from bare render() to renderWithProviders()
which wraps in QueryClientProvider.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-20 17:25:36 -08:00
yuneng-jiang
ed4b654934 [Fix] Include all SpendLogsMetadata keys in spend logs payload
The dict comprehension in _get_spend_logs_metadata was only including
metadata keys that existed in the input dict. After user_api_key_project_id
was added to SpendLogsMetadata, payloads missing that key in input would
not include it in output, causing test_spend_logs_payload to fail.

Use metadata.get(key) instead of filtering with `if key in metadata`
to ensure all SpendLogsMetadata keys are always present (defaulting to
None), consistent with the metadata-is-None branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-20 17:25:28 -08:00
yuneng-jiang
e08989dd8f Fix credential name tag injection by moving to Router level
The previous approach tried to inject litellm_credential_name as a tag
in get_standard_logging_object_payload, but the credential name was never
available in litellm_params because the Logging object is created by the
proxy BEFORE the Router selects a deployment. The credential name only
exists in the deployment's litellm_params, which is resolved later.

This fix injects the credential name as a tag in
Router._update_kwargs_with_deployment(), right alongside the existing
deployment-level tags mechanism. This ensures the credential name flows
through the normal metadata.tags pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 17:16:36 -08:00
Ryan Crabbe
d6c6d12549 rename test file to test_redis_connection_pool.py 2026-02-20 17:10:08 -08:00
Ryan Crabbe
6931fea929 fix: close leaked Redis connection pools on cache eviction and disconnect
- RC1: Override _remove_key() in LLMClientCache to schedule aclose() on
  evicted async clients instead of relying on GC
- RC2: Use passed connection_pool for URL configs instead of creating an
  orphaned pool via from_url()
- RC3: Pass max_connections through to BlockingConnectionPool.from_url()
  for URL configs, with input validation for invalid values
- RC5: Close sync redis_client in disconnect() with try/except guard
2026-02-20 17:09:32 -08:00
yuneng-jiang
8c5d48348c Inject credential name as tag in standard logging payload for Usage page filtering
When a model has a litellm_credential_name, append it to request_tags during
logging so it flows into DailyTagSpend and becomes filterable in the Usage page.

- Add litellm_credential_name to _OPTIONAL_KWARGS_KEYS so it survives into
  litellm_params during get_litellm_params() filtering
- Read credential name from litellm_params in get_standard_logging_object_payload()
  and append to request_tags if not already present

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:44:34 -08:00
Ishaan Jaff
d11832bfad
fix(responses): eliminate per-chunk thread spawning in async streaming path (#21709)
* fix(responses): fix O(n²) CPU overhead in reasoning streaming path

stream_chunk_builder was called on every reasoning chunk, rebuilding the
entire response from all collected chunks each time. Replace with
incremental accumulation of reasoning_content parts, only joining at
reasoning end.

* fix(responses): eliminate per-chunk thread spawning in async streaming path

_process_chunk() called run_async_function() on every SSE chunk, which
when invoked from an async context spawns a thread + event loop per call.

Move the hook call out of _process_chunk into the callers: async __anext__
directly awaits it, sync __next__ uses run_async_function.

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

* perf: reduce responses streaming CPU for text-only streams

* fix(test): replace deprecated claude-3-7-sonnet-latest in responses API test

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

* fix(test): replace deprecated claude-3-7-sonnet-latest in tool result fix test

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

* fix(test): replace deprecated claude-3-7-sonnet-latest in tool result empty call_id test

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:26:23 -08:00
yuneng-jiang
be56786c5d
Merge pull request #21708 from BerriAI/litellm_logs_table_filter_bug
[Fix] UI - Logs: Fix table not updating and pagination issues
2026-02-20 16:25:24 -08:00
yuneng-jiang
f5caa34ebe [Fix] UI - Logs: disable main query while backend filters are active
When backend filters (Key Alias, Key Hash, etc.) were active, the main
logs query still refetched whenever startTime/endTime/sort/page changed,
firing a redundant unfiltered server request whose result was discarded.
Expose hasBackendFilters from useLogFilterLogic and use it to gate the
main query's enabled condition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 16:03:48 -08:00
yuneng-jiang
0c6bcf6eca
Merge pull request #21613 from BerriAI/litellm_usage_perf_fix
[Fix] Aggregated Daily Activity Endpoint Performance
2026-02-20 15:41:28 -08:00
yuneng-jiang
8d7a4c518e Adding build 2026-02-20 15:40:08 -08:00
yuneng-jiang
a8d37b9385 bump: version 0.4.44 → 0.4.45 2026-02-20 15:39:44 -08:00