Commit Graph
22804 Commits
Author SHA1 Message Date
Ishaan Jaff eec0e4d2be docs - web search 2025-06-23 21:25:35 -07:00
Ishaan Jaff 5442611a0b fix linting v1.73.1-nightly 2025-06-23 20:10:39 -07:00
Ishaan Jaff 3d542846b2 test fix 2025-06-23 20:03:26 -07:00
d677a6bda2 [Bug Fix] Bedrock Guardrail - Don't raise exception on intervene action (#11875)
* Refactor Bedrock guardrails to handle BLOCKED vs ANONYMIZED actions

* Enhance Bedrock guardrail masking with improved anonymization logic

* fix _should_raise_guardrail_blocked_exception

* test_bedrock_guardrail_uses_masked_output_without_masking_flags

* fix linting error

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-06-23 19:59:44 -07:00
Ishaan Jaff d4ba4900cf bump litellm enterprise 2025-06-23 19:36:31 -07:00
Ishaan Jaff 5534387c22 bump: version 1.73.0 → 1.73.1 2025-06-23 19:34:55 -07:00
Ishaan Jaff 321fc09b3e ui fix linting errors 2025-06-23 18:43:56 -07:00
Ishaan Jaff 4f98862ef9 test_azure_common_utils.py 2025-06-23 18:34:48 -07:00
Ishaan Jaff 77813ebdf8 ui - fix linting error 2025-06-23 18:18:36 -07:00
hsuyumingandGitHub 180ed14918 fix: fix test_get_azure_ad_token_with_oidc_token testcase issue, because (#11988)
CI/CD pipeline setup AZURE_CLIENT_SECRET within enviroment variable, so
we need to setup as None in this case
2025-06-23 18:11:06 -07:00
Ishaan JaffandGitHub b5c48c8c22 [Feat] Add List Callbacks API Endpoint (#11987)
* add get_callbacks_by_type

* add list_callbacks

* fix _get_callback_string

* add callback_management_endpoints_router

* fix proxy config.yaml

* fixes list callbacks

* TestCallbackManagementEndpoints

* update docs

* docs Response Fields

* docs header format

* docs Dynamic Callback Management
2025-06-23 15:34:25 -07:00
Cole McIntoshandGitHub eacb4dfdef Add Mistral 3.2 24B to model mapping (#11926)
* feat(model_prices_and_context_window.json): add mistral-small-3.2-24b-instruct model with token costs and chat mode support

* fix(model_prices_and_context_window.json): update model paths to include 'openrouter' prefix for mistral-small-3.1 and 3.2
2025-06-23 14:54:39 -07:00
8c5fb6f539 [Feat] Enterprise - Allow dynamically disabling callbacks in request headers (#11985)
* Add support for disabling callbacks via x-litellm-disable-callbacks header

* add _is_callback_disabled_via_headers

* add get_proxy_server_request_headers

* _is_callback_disabled_via_headers

* X_LITELLM_DISABLE_CALLBACKS

* add EnterpriseCallbackControls

* use EnterpriseCallbackControls

* use CustomLoggerRegistry

* use CustomLoggerRegistry

* CustomLoggerRegistry

* EnterpriseCallbackControls

* TestEnterpriseCallbackControls

* docs clean up

* docs dynamic callbacks

* doc fixes

* fix code qa checks

* fix CustomLoggerRegistry

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-06-23 14:32:05 -07:00
Cole McIntoshandGitHub 02a095d4db feat: implement Perplexity citation tokens and search queries cost calculation (#11938)
* feat: add citation_cost_per_token and search_queries_cost_per_1000 fields to ModelInfoBase

- Add citation_cost_per_token field to ModelInfoBase for Perplexity citation token costs
- Add search_queries_cost_per_1000 field to ModelInfoBase for Perplexity search query costs
- Update _get_model_info_helper to include these fields in model info responses
- Enables proper cost calculation for Perplexity-specific usage metrics

* feat: update Perplexity sonar-deep-research model pricing configuration

- Update input/output token costs to / per million tokens respectively
- Add reasoning token cost at  per million tokens
- Add citation_cost_per_token at  per million tokens (same as input)
- Add search_queries_cost_per_1000 at /bin/zsh.005 per 1000 search queries
- Remove deprecated search_context_cost_per_query structure
- Aligns with Perplexity's updated pricing model for deep research capabilities

* feat: implement Perplexity-specific cost calculator

- Create cost_per_token function for Perplexity provider
- Calculate standard input/output token costs
- Add citation token cost calculation using citation_cost_per_token rate
- Add reasoning token cost calculation with fallback to completion_tokens_details
- Add search query cost calculation using search_queries_cost_per_1000 rate
- Return separate prompt_cost and completion_cost for accurate billing
- Handles all Perplexity-specific usage metrics: citation_tokens, num_search_queries, reasoning_tokens

* feat: integrate Perplexity cost calculator with main cost calculation system

- Import perplexity_cost_per_token function in main cost calculator
- Add perplexity provider case to cost_per_token function
- Enables automatic routing of Perplexity cost calculations to provider-specific logic
- Maintains compatibility with existing cost calculation patterns
- Supports all Perplexity-specific cost metrics through unified interface

* feat: enhance Perplexity response transformation to extract cost-related fields

- Override transform_response method to extract Perplexity-specific usage fields
- Add _enhance_usage_with_perplexity_fields method to process API responses
- Extract citation_tokens from citations array using character-based estimation (~4 chars/token)
- Extract num_search_queries from both usage field and root level with priority handling
- Create usage object when none exists to ensure cost fields are always captured
- Handle empty citations and missing fields gracefully
- Enables automatic extraction of cost metrics from Perplexity API responses

* test: add comprehensive test suite for Perplexity cost calculation features

Add 82 comprehensive tests across 3 test files:

- test_perplexity_cost_calculator.py (59 tests):
  * Cost calculation with citation tokens, search queries, reasoning tokens
  * Various combinations and edge cases
  * Integration with main cost calculator
  * Model info access and validation
  * Zero values and missing fields handling

- test_perplexity_chat_transformation.py (12 tests):
  * Citation token extraction from API responses
  * Search query extraction from usage and root fields
  * Priority handling and field aggregation
  * Empty citations and missing fields handling
  * Token estimation accuracy validation

- test_perplexity_integration.py (11 tests):
  * End-to-end cost calculation workflows
  * High-volume and edge case scenarios
  * Model info integration validation
  * Case-insensitive provider matching
  * Transformation preservation of existing fields

Ensures reliability and correctness of all Perplexity cost features with comprehensive coverage of happy path, edge cases, and error conditions.

* fix: remove unused Union import from Perplexity transformation

- Remove unused typing.Union import from litellm/llms/perplexity/chat/transformation.py
- Fixes F401 linting error: 'typing.Union imported but unused'
- Maintains only necessary imports: Any, List, Optional, Tuple

* Fix JSON schema validation and use web_search_requests field

- Add citation_cost_per_token and search_queries_cost_per_1000 to JSON schema
- Update Perplexity transformation to use web_search_requests in PromptTokensDetailsWrapper
- Update Perplexity cost calculator to read from web_search_requests field
- Maintain backward compatibility while using standard LiteLLM fields

* Fix type errors in Perplexity cost calculator

- Add null checks for token counts and cost values to prevent None multiplication errors
- Use .get() with fallback values instead of direct dictionary access
- Ensure all arithmetic operations handle None values safely

This fixes the failing job 44517525148 type errors.

* Refactor Perplexity cost calculation tests to improve accuracy and consistency

- Replace absolute difference assertions with math.isclose for better precision in cost comparisons
- Update tests to utilize PromptTokensDetailsWrapper for handling web search requests
- Ensure all test cases correctly reflect the new structure of usage fields, enhancing clarity and maintainability

* fix: address type hinting issues in PerplexityChatConfig usage handling

- Add type ignore comments to model_response.usage assignments to resolve type checking errors
- Ensures compatibility with type definitions while maintaining existing functionality

* Update model pricing configuration in JSON backup

- Add citation_cost_per_token and search_queries_cost_per_1000 fields to enhance cost tracking
- Remove deprecated search_context_cost_per_query structure to streamline pricing model
- Aligns with recent updates in Perplexity's pricing strategy

* Update search queries cost structure in model_prices_and_context_window.json to use search_context_cost_per_query

* Refactor search queries cost structure in model_prices_and_context_window_backup.json and update related code to use search_queries_cost_per_query. Remove deprecated search_queries_cost_per_1000 references across model info and tests.

* Enhance cost calculation in cost_calculator.py by introducing a safe float casting function to handle potential None and invalid values. Update cost calculations for input, citation, output, reasoning, and search query tokens to use this new function, ensuring more robust handling of model pricing data.

* Refactor cost calculation in cost_calculator.py to support both legacy and current search cost keys. Enhance handling of search cost values by accommodating both dictionary and float formats, ensuring robust cost computation for search queries.

* Update test cases to reflect changes in cost structure, renaming search_queries_cost_per_query to search_context_cost_per_query for consistency with recent refactor. Ensure assertions in tests align with updated cost keys.

* Update test_perplexity_integration.py to rename search_queries_cost_per_query to search_context_cost_per_query, ensuring consistency with recent cost structure changes. Adjust assertions to align with updated cost keys.
2025-06-23 14:15:25 -07:00
ef7f8cce93 [Bug Fix] Perplexity - LiteLLM doesn't support 'web_search_options' for Perplexity' Sonar Pro model (#11983)
* TestPerplexityWebSearch

* use supports_web_search

* Update tests/test_litellm/llms/perplexity/test_perplexity.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-23 10:21:50 -07:00
Juan Cruz-BenitoandGitHub 962fd67227 Fixing watsonx error: 'model_id' or 'model' cannot be specified in the request body for models in a deployment space (#11854)
* Fixing watsonx error: 'model_id' or 'model' cannot be specified in the request body for models in a deployment space

* Revert "Fixing watsonx error: 'model_id' or 'model' cannot be specified in the request body for models in a deployment space"

This reverts commit 9d16a3000b24d255f70ab74c01eb6267354df151.

* Implementing feedback from code review
2025-06-23 10:14:10 -07:00
ShankygandGitHub 30318c40c9 fix unrecognised parameter reasoning_effort (#11838)
* fix unrecognised parameter reasoning_effort

* review changes
2025-06-23 10:11:40 -07:00
b3d8a6be9e Proxy UI MCP Auth passthrough (#11968)
* initial mcp auth with special header

* MCP Servers moved and added auth part

* Pass in x-mcp-auth with banner on tool call

* Revert "initial mcp auth with special header"

This reverts commit b22fb6d12e9af17701ab5ec58ab559663073416b.

---------

Co-authored-by: wagnerjt <wagnerjt@github.com>
2025-06-23 09:34:37 -07:00
Ishaan JaffandGitHub cde20cf825 fix - checking proxy settings (#11947) 2025-06-23 09:30:40 -07:00
Mukesh Sai KumarandGitHub a44ff7c486 Fix markdown table not rendering properly (#11969) 2025-06-23 09:28:51 -07:00
Cole McIntoshandGitHub 3ab1dfad08 Add GitHub Actions workflow for LLM translation testing artifacts (#11780)
* Add GitHub Actions workflow for LLM translation testing artifacts

* Update LLM translation testing workflow to fetch results from CircleCI and improve timeout settings. The job name has been changed for clarity, and the installation of dependencies has been replaced with CircleCI CLI setup. Placeholder test results are created if no CircleCI artifacts are found.
2025-06-23 09:23:27 -07:00
Cole McIntoshandGitHub 464d981f1c feat: add Last Success column to health check table (#11903) 2025-06-23 09:22:00 -07:00
hsuyumingandGitHub e3ba888c63 fix: make response api support Azure Authentication method (#11941)
* fix: make response api support Azure Authentication method
1. Support diverse Azure authentication methods
2. Use distinct headers for API key and Azure AD token base on this
   documentation (https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/responses?tabs=rest-api#generate-a-text-response)

* fix: fix path issue

* fix lint error

* rename test_transformation.py to test_azure_transformation.py

* change litellm_params as Optional type
2025-06-23 08:43:20 -07:00
Ishaan JaffandGitHub 05b95eb702 docs - Recommended Machine Specifications (#11980) 2025-06-23 08:26:29 -07:00
2d05692e2f Fix SambaNova 'created' field validation error - handle float timestamps (#11971)
* Fix SambaNova 'created' field validation error

SambaNova API returns 'created' field as float but LiteLLM expects integer.
Added _safe_convert_created_field() helper to handle float->int conversion
while maintaining backward compatibility with existing integer timestamps.

* Update litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2025-06-23 07:53:21 -07:00
Ishaan Jaff b36dbb870c fix ghcr 2025-06-22 09:06:58 -07:00
Ishaan Jaff 9e5c97aabd fix pip pkg 2025-06-22 09:05:45 -07:00
Krrish Dholakia c0de1320fc docs(index.md): update release notes with default team for new users 2025-06-21 23:09:47 -07:00
Ishaan Jaff b1e3507d14 ui new build v1.73.0.rc.1 2025-06-21 20:53:18 -07:00
Krish DholakiaandGitHub 7f3d8bb9c5 Management Fixes - don't apply default internal user settings to admins + preserve all model access for teams with empty model list, when team model added + /v2/model/info fixes (#11957)
* fix(internal_user_endpoints.py): don't apply default internal user params if role is admin

prevent internal user restrictions from being applied to admin

* fix(proxy_server.py): fix model info v2 endpoint check - handle user_id being none

* fix(team_endpoints.py): ensure team doesn't lose all model access if set as empty string and new team model added

* fix(proxy_server.py): ensure model with team id is only added as valid for team which has that id
2025-06-21 20:33:10 -07:00
Krrish Dholakia 10cf7d52eb docs: add further reading link in self serve docs 2025-06-21 17:03:25 -07:00
Krish DholakiaandGitHub 3224b0f4fe (Tutorial) Onboard Users for AI Exploration (#11955)
* fix: allow setting no-default-models and unsetting max budget

* docs(sso_self_serve.md): add e2e tutorial of onboarding users for ai exploration

* docs: rename doc
2025-06-21 16:54:23 -07:00
Ishaan Jaff 1b43ba9426 bump: version 1.72.9 → 1.73.0 v1.73.0-nightly 2025-06-21 16:45:34 -07:00
Ishaan Jaff 84bacef587 test_internal_user_endpoints.py 2025-06-21 16:45:14 -07:00
Ishaan Jaff 9867432ef4 docs pass through 2025-06-21 16:41:04 -07:00
Ishaan Jaff 6cd799a78c docs release notes 2025-06-21 16:37:35 -07:00
Ishaan Jaff 94a8ae393c bump litellm-enterprise-0.1.8 2025-06-21 16:00:36 -07:00
Ishaan Jaff 7006cd4139 test ui sso 2025-06-21 15:58:48 -07:00
Ishaan Jaff 6cd2fe4879 test_team_endpoints.py 2025-06-21 15:57:58 -07:00
Ishaan Jaff a3bfd29104 fixes release notes 2025-06-21 15:38:54 -07:00
Ishaan Jaff 30d6301a94 fix release notes 2025-06-21 15:37:12 -07:00
Ishaan Jaff 9aef2cdea6 docs pass through 2025-06-21 15:36:34 -07:00
Krish DholakiaandGitHub 2404d3fb1b Show user all models they can call (Across teams) on UI (#11948)
* fix(proxy_cli.py): check for module not found error on proxy import

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

* feat(proxy_server.py): utility function to get all models across all teams user is in

Allows user to see all team models on UI

* feat(proxy_server.py): return models accessible via team id's in `/v2/model/info`

Allows UI to tell user which team they can use to access model

* feat(columsn.tsx): initial PR to add 'accessible via Team ID's on model hub

allows user to know what teams they can access a model through

* Revert "feat(columsn.tsx): initial PR to add 'accessible via Team ID's on model hub"

This reverts commit f844c79383ec6739ed712f59e33a524a26b3d35a.

* fix(proxy_server.py): backend model info endpoint improvements

* UI Improvements for Default User access (#11952)

* feat(ui/): add a 'current team' and 'view' filters to the models page

allow user to see what all models they have access to within a specific team

* feat: working ui for seeing models in teams

* fix(model_dashboard.tsx): make current team filter more prominent

* style(model_dashboard.tsx): add a helpful note telling user how to create a model for the team they've selected

* style(model_dashboard.tsx): only show helpful note when current view is team, not for global

* fix(team_dropdown.tsx): allow searching by team id on create key modal

* feat(create_key_button.tsx): add helpful message when team selection is required

* fix: fix linting checks

* fix: fix ui linting error

* docs(team_endpoints.py): document new param
2025-06-21 15:29:25 -07:00
Krrish Dholakia 6c17e856d1 fix: fix linting error 2025-06-21 15:29:10 -07:00
Ishaan Jaff db219ffca0 docs pass through 2025-06-21 15:24:17 -07:00
Ishaan Jaff c7972b55ce docs - pass through 2025-06-21 15:18:15 -07:00
Ishaan Jaff 0bed17068b docs add imgs 2025-06-21 15:11:58 -07:00
Ishaan Jaff 045026462f ui - add team indicator to ui 2025-06-21 14:55:09 -07:00
Krrish DholakiaandIshaan Jaff b7843b9113 docs(team_endpoints.py): document new param 2025-06-21 14:39:45 -07:00
Ishaan Jaff 1c30d2745f fix is_team_count_over_limit 2025-06-21 14:28:05 -07:00