Commit Graph
3634 Commits
Author SHA1 Message Date
Ishaan JaffandGitHub 1c56a0d856 [Fix] Watsonx - Apply correct prompt templates for openai/gpt-oss model family (#15341)
* fix: apply_prompt_template

* Revert "fix: apply_prompt_template"

This reverts commit 3e0e40b497.

* add apply_prompt_template for WatsonX

* feat: add apply_prompt_template

* test_watsonx_gpt_oss_prompt_transformation

* Revert "add apply_prompt_template for WatsonX"

This reverts commit 3e80903796e39d4fe7206d63445e024c3ad8d0c4.

* add apply_prompt_template for WatsonX

* fix apply_prompt_template

* fix: add hf template handler

* fix hf_chat_template

* fix _get_tokenizer_config

* fix hf_chat_template

* add WatsonXModelPattern

* fix aapply_prompt_template
2025-10-08 15:39:36 -07:00
Krish DholakiaandGitHub 13703f289b Merge pull request #15292 from timelfrink/fix/bedrock-prompt-caching-cost-calculation
fix(bedrock): include cacheWriteInputTokens in prompt_tokens calculation
2025-10-07 19:11:45 -07:00
Ishaan Jaffer e1ab3620ee fix: mapped tests 2025-10-07 17:55:52 -07:00
Ishaan Jaffer 8590646b84 fix code QA check 2025-10-07 17:49:57 -07:00
Ishaan JaffandGitHub 36c971a6fd [MCP Gateway] QA/Fixes - Ensure Team/Key level enforcement works for MCPs (#15305)
* fix: _set_object_permission

* fix: _set_object_permission on teams

* fix: _set_object_permission

* fixes for team/key permissions

* statsh: object permission view

* fix: MCPServerPermissions

* fix: _get_team_object_permission

* test mcp checks for permissions

* fix server checks with prefix names

* test_list_tools_strips_prefix_when_matching_permissions

* ruff fix

* docs - refactor MCP

* docs update MCP docs

* docs allowed tools
2025-10-07 17:34:48 -07:00
Ishaan JaffandGitHub 7b56ba240e [MCP Gateway] Litellm mcp fixes team control (#15304)
* fix: _set_object_permission

* fix: _set_object_permission on teams

* fix: _set_object_permission

* fixes for team/key permissions

* statsh: object permission view

* fix: MCPServerPermissions
2025-10-07 16:48:00 -07:00
Ishaan JaffandGitHub bc26eff98f Fix: Make PATCH /model/{model_id}/update handle team_id consistently with POST /model/new (#15297)
* fix: _update_team_model_in_db

* test_patch_model_with_team_id_creates_proper_setup
2025-10-07 14:04:08 -07:00
Ishaan JaffandGitHub 07a17d6d6b [Feat] Proxy CLI - dont store existing key in the URL, store it in the state param (#15290)
* Feat: CLI Auth fixes for UI SSO

* fix auth.py

* fix test ui sso.py
2025-10-07 12:36:17 -07:00
Tim Elfrink c5eb22381d fix(bedrock): include cacheWriteInputTokens in prompt_tokens calculation
Fixes #15263

This PR fixes the cost calculation for Bedrock Anthropic models with prompt caching.

**Root Cause:**
PR #9838 incorrectly removed adding `cacheWriteInputTokens` to `prompt_tokens`
for Bedrock, based on the assumption that it would cause double counting (similar
to an Anthropic API issue). However, Bedrock's token structure is different:

- **Bedrock API**: `inputTokens`, `cacheReadInputTokens`, and `cacheWriteInputTokens`
  are ALL separate values that should be summed for total input tokens
- **Anthropic API**: Same structure - all three token types are separate

The fix in #9838 was later reverted for Anthropic (correctly re-adding
`cache_creation_input_tokens` to `prompt_tokens`), but Bedrock was never fixed.

**Changes:**
1. Re-add `cacheWriteInputTokens` to `input_tokens` in Bedrock transformation
2. Update test assertions to reflect correct behavior
3. Add regression test for prompt caching cost calculation
4. Fix typo in Anthropic transformation where `cache_creation_tokens` was
   incorrectly set to `cache_read_input_tokens`

**Testing:**
- All existing Bedrock transformation tests pass
- New test validates correct cost calculation with prompt caching
- Verified costs are non-negative and accurate
2025-10-07 20:28:46 +02:00
Sameer KankuteandGitHub e4892735f0 fix gemini cli by actually streaming the response (#15264)
* fix gemini cli by actually streaming the response

* fix cost tracking

* fix test
2025-10-07 11:26:39 -07:00
Sameer KankuteandGitHub 73f96712f5 fix the reasoningresponse id (#15265) 2025-10-07 11:24:29 -07:00
Sameer KankuteandGitHub c0d0424eb8 Added streaming support for response api streaming image generation (#15269) 2025-10-07 08:15:57 -07:00
Krish DholakiaandGitHub 94a34dd53a Merge branch 'main' into litellm_dev_10_06_2025_p1 2025-10-06 20:06:30 -07:00
Krish DholakiaandGitHub 8b357c24c2 Merge pull request #15226 from otaviofbrito/chore/vertex-ai-context-caching
Chore/vertex ai context caching
2025-10-06 20:05:24 -07:00
Krish DholakiaandGitHub 6b4415684e Merge pull request #15253 from BerriAI/litellm_dev_10_06_2025_p2
fix(azure/responses): remove invalid status param from azure call + MCP - support setting CA_BUNDLE_PATH
2025-10-06 20:01:39 -07:00
Sameer KankuteandGitHub 8d7f39798c Removed stop param from unsupported azure models (#15229)
* Removed stop param from unsupported model

* Use better handling for stop method

* Use better handling for stop method
2025-10-06 19:56:18 -07:00
Krish DholakiaandGitHub 6bb34e5168 Merge pull request #15252 from BerriAI/litellm_view_key_pagination_calls_fix
(perf) fix: Replaces bloated key list calls with lean key aliases endpoint
2025-10-06 19:51:26 -07:00
Ishaan JaffandGitHub 1d468a59f3 [MCP Gateway] Fine-grained Database Object Storage Control (#15255)
* add supported_db_objects

* add _should_load_db_object

* add docs on storing MCP objects in DB

* test_should_load_db_object_with_supported_db_objects

* type fix
2025-10-06 19:31:44 -07:00
Ishaan JaffandGitHub 930f88078e [MCP Gateway] Backend - Allow storing allowed tools by team/key (#15243)
* add mcp_tool_permissions column to LiteLLM_ObjectPermissionTable

* add mcp_tool_permissions

* add LiteLLM_ObjectPermissionTable

* test key/team mgmt

* fix code QA check

* fix check_tool_permission_for_key_team

* test_key_tool_permission_allows_permitted_tool

* test_list_tools_filters_by_key_team_permissions

* fix _get_tools_from_mcp_servers

* fix logger.debug

* fix check_tool_permission_for_key_team

* fix: filter_tools_by_key_team_permissions

* fix _get_team_object_permission

* fix _set_object_permission

* fix handle_update_object_permission_common

* fix add allowed tools to keys

* test add key/team level tool permissions for MCPs
2025-10-06 18:49:32 -07:00
Krrish Dholakia 7f88a3f9c6 fix(mcp/): add ssl certificate settings for mcp clients
respect ca bundle path for mcp calls
2025-10-06 18:36:05 -07:00
Achintya RajanandGitHub 264f1cded1 Merge branch 'main' into litellm_view_key_pagination_calls_fix 2025-10-06 18:10:57 -07:00
Krrish Dholakia 5336fcc000 fix(azure/responses): always remove status
unsupported parameter
2025-10-06 18:08:57 -07:00
Krrish Dholakia d7aab1d5de test: add unit tests 2025-10-06 13:53:36 -07:00
Sameer KankuteandGitHub cd25782359 fix passing headers for gemini (#15231) 2025-10-06 12:59:19 -07:00
Alexsander HamirandGitHub ddb90c9ad7 [Fix] - Router: add model_name index for O(1) deployment lookups (#15113)
* perf(router): add model_name index for O(1) deployment lookups

Add model_name_to_deployment_indices mapping to optimize _get_all_deployments()
from O(n) to O(1) + O(k) lookups.

- Add model_name_to_deployment_indices: Dict[str, List[int]]
- Add _build_model_name_index() to build/maintain the index
- Update _add_model_to_list_and_index_map() to maintain both indices
- Refactor to use idx = len(self.model_list) before append (cleaner)
- Optimize _get_all_deployments() to use index instead of linear scan

* test(router): add test coverage for _build_model_name_index

Add single comprehensive test for _build_model_name_index() function to fix
code coverage CI failure.

The test verifies:
- Index correctly maps model_name to deployment indices
- Handles multiple deployments per model_name
- Clears and rebuilds index correctly

Fixes: CI code coverage error for _build_model_name_index
2025-10-06 08:14:11 -07:00
Otavio Brito b2a734c1f8 fix ttl tests 2025-10-06 09:30:23 -03:00
Otavio Brito 251d56ba5e update docs 2025-10-05 23:47:24 -03:00
Javier de la TorreandClaude df232a71f1 feat(snowflake): add function calling support for Snowflake Cortex REST API
Add support for function calling (tools) with Snowflake Cortex models that support it (e.g., Claude 3.5 Sonnet).

Changes:
- Add 'tools' and 'tool_choice' to supported OpenAI parameters
- Implement request transformation: OpenAI function format → Snowflake tool_spec format
- Implement response transformation: Snowflake content_list with tool_use → OpenAI tool_calls
- Add tool_choice transformation: OpenAI nested format → Snowflake array format

Request transformation:
- Transform tools from nested {"type": "function", "function": {...}} to Snowflake's {"tool_spec": {"type": "generic", "name": "...", "input_schema": {...}}}
- Transform tool_choice from {"type": "function", "function": {"name": "..."}} to {"type": "tool", "name": ["..."]}

Response transformation:
- Parse Snowflake's content_list array containing tool_use objects
- Extract tool calls with tool_use_id, name, and input
- Convert to OpenAI's tool_calls format with proper JSON serialization

Testing:
- Add 7 unit tests covering request/response transformations
- Add integration test for Responses API with tool calling
- All tests passing

Fixes issue #15218

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 13:08:33 +02:00
Krrish Dholakia 63cb2764fe test: fix raise 2025-10-04 16:11:22 -07:00
Krrish Dholakia 2d1000c461 test: update tests 2025-10-04 15:31:25 -07:00
Krish DholakiaandGitHub a9037ab61f Merge branch 'main' into litellm_dev_10_03_2025_p1 2025-10-04 15:23:31 -07:00
Krish DholakiaandGitHub 75e3f4e10d Merge pull request #15120 from BerriAI/litellm_dev_10_01_2025_p2
(feat) Support 'guaranteed_throughput' when setting limits on keys belonging to a team
2025-10-04 15:22:47 -07:00
Krish DholakiaandGitHub b188f76dbe Merge pull request #15201 from BerriAI/litellm_staging_10_04_2025_p2
(security) prevent user key from updating other user keys + don't return all keys with blank key alias on /v2/key/info
2025-10-04 14:58:00 -07:00
Krrish Dholakia bb5011597c test: fix minor test 2025-10-04 14:55:04 -07:00
Krrish Dholakia 814e49df06 test: update tests 2025-10-04 14:39:50 -07:00
Ishaan JaffandGitHub ec9cdf783a Revert "Add streamGenerateContent cost tracking in passthrough (#15199)" (#15202)
This reverts commit 8095de506a.
2025-10-04 14:37:02 -07:00
= 6ba077593f Update test_key_generate_prisma.py 2025-10-04 14:36:19 -07:00
= 5e03ef7382 fixes bloated key alias network calls with lean endpoint 2025-10-04 14:32:15 -07:00
Sameer KankuteandGitHub 8095de506a Add streamGenerateContent cost tracking in passthrough (#15199)
* Add streamgenerate cost tracking for gemini provider

* add cost tracking test
2025-10-04 12:31:25 -07:00
Ishaan Jaffer 3d6342f852 test_twelvelabs_missing_input_type_error 2025-10-04 12:28:09 -07:00
Ishaan Jaffer be7ab0b3e3 test_gemini_url_context 2025-10-04 12:23:43 -07:00
Ishaan Jaffer c38c5d20cc test dynamic rate limiter 3 2025-10-04 12:06:13 -07:00
Ishaan Jaffer 7a41c09529 test bedrock embedding tests marengo 2025-10-04 11:27:29 -07:00
Ishaan Jaffer 44db58c8df test_e2e_bedrock_async_invoke_embedding_async_twelvelabs_marengo 2025-10-04 11:13:39 -07:00
Ishaan Jaffer 53503828b2 test fix 2025-10-04 10:57:02 -07:00
Ishaan Jaffer 6f298cf5f0 test_azure_openai_assistants_e2e_operations_stream 2025-10-04 10:53:46 -07:00
Ishaan JaffandGitHub f78608082c [Feat] Dynamic Rate Limiter v3 - fixes for detecting saturation + fixes for post saturation behavior (#15192)
* fix: test case 1, model hits saturation

* fix: _check_rate_limits test case 2

* fix: _get_priority_allocation

* test_default_priority_shared_pool

* fix: No Rate Limiting when low saturatation

* fix: correctly use  model_saturation_check

* fixes priority_descriptors

* fix: tune default PriorityReservationSettings
2025-10-04 10:45:17 -07:00
Ishaan Jaffer ee36c30217 fix LF tests 2025-10-04 10:39:17 -07:00
Ishaan Jaffer 00f44861ea fix: gooogle GenAI route tests 2025-10-04 10:18:25 -07:00
Ishaan Jaffer 1655a9aea8 fix lf tests 2025-10-04 10:02:56 -07:00