Commit Graph
93 Commits
Author SHA1 Message Date
Sameer Kankute b729622bf5 Fix: generationConfig removal from tests 2026-01-22 19:00:37 +05:30
Cesar GarciaandGitHub d30c25af21 feat(gemini): use responseJsonSchema for Gemini 2.0+ models (#19314)
* feat(gemini): add opt-in support for responseJsonSchema

Add support for Gemini's native responseJsonSchema parameter which uses
standard JSON Schema format instead of OpenAPI-style responseSchema.

Benefits of responseJsonSchema (Gemini 2.0+ only):
- Standard JSON Schema format (lowercase types)
- Supports additionalProperties for stricter validation
- Better compatibility with Pydantic's model_json_schema()
- No propertyOrdering required

Usage:
```python
response_format={
    "type": "json_schema",
    "json_schema": {"schema": {...}},
    "use_json_schema": True  # opt-in
}
```

This is backwards compatible - existing code continues to use
responseSchema by default.

Closes #16340

* docs: add documentation for use_json_schema parameter

Document the new use_json_schema option for Gemini 2.0+ models
in the JSON Mode documentation.

* refactor(gemini): use responseJsonSchema by default for Gemini 2.0+

Remove opt-in flag `use_json_schema` and automatically detect model version:
- Gemini 2.0+: uses responseJsonSchema (standard JSON Schema, supports additionalProperties)
- Gemini 1.5: uses responseSchema (OpenAPI format, legacy)

This follows LiteLLM's philosophy of abstracting provider differences -
users write the same code regardless of model version.

* test(vertex): update json_schema tests to accept both responseSchema formats

Gemini 2.x+ uses responseJsonSchema while Gemini 1.x uses responseSchema.
Update tests to accept both formats since litellm now auto-selects based
on model version.
2026-01-19 10:45:37 -08:00
Ishaan Jaffer 3c0d530197 test_async_vertexai_response_basic 2025-11-01 10:58:48 -07:00
Alexsander HamirandGitHub 8c5118195d fix: replace deprecated gemini-1.5-pro-preview-0514 with gemini-2.5-flash-lite in function calling test (#15852) 2025-10-23 11:48:58 -07:00
Krish DholakiaandGitHub 12a1d081ee Merge branch 'main' into litellm_dev_09_11_2025_p1 2025-10-08 19:02:58 -07:00
Ishaan JaffandGitHub 10d6d72ae3 [Feat] VertexAI - Support googlemap grounding in vertex ai (#15179)
* add VertexToolName

* test_vertex_tool_params

* fix: working maps grounding

* test_gemini_google_maps_tool_simple

* test_vertex_ai_map_google_maps_tool_with_location

* fix  # noqa: PLR0915

* _extract_google_maps_retrieval_config

* fixes for linting

* docs: **Google Maps**
2025-10-03 16:07:51 -07:00
Ishaan Jaffer f1578b49e2 vertex_httpx_mock_post 2025-09-29 18:25:54 -07:00
Ishaan Jaffer bb4b7fdd00 test_gemini_pro_function_calling_httpx 2025-09-27 12:43:06 -07:00
Alexsander HamirandGitHub eaa04cd8ce fix: use fastuuid helper (#14903)
* fix: use fastuuid helper across the codebase

First batch of changes, simple drop in replacement.

* second batch of changes

* fixed: script mistake on helper file
2025-09-25 15:47:01 -07:00
Ishaan Jaffer e1b342604d test vertex test_get_token_url 2025-09-23 19:34:50 -07:00
Sameer KankuteandGitHub d213a2e066 correct the gaurdcontent name (#14684)
* correct the gaurdcontent name

* correct the gaurdcontent name

* fix model required error in test

* Add correct model
2025-09-18 11:00:19 -07:00
Krrish Dholakia 3f3efea301 test(test_gemini.py): add additional testing for additionalproperties case 2025-09-11 15:12:21 -07:00
Ishaan Jaff 8e9352fce7 test fix 2025-09-03 11:06:09 -07:00
Ishaan JaffandGitHub c821f1ddf1 [Feature]: Support GPT-OSS models on vertex ai (#14184)
* add VertexAIGPTOSSTransformation

* fix: optional_params

* fix: is_vertex_partner_model

* test_partner_models_httpx

* docs GPT oss docs

* test_vertex_ai_gpt_oss_reasoning_effort

* add vertex ai models
2025-09-02 14:15:26 -07:00
Ishaan JaffandGitHub 6ce1d82970 [Bug] Fix: Vertex Mistral not working for streaming (#13952)
* fix OpenAI like chat handler

* fix MockResponse

* test_partner_models_httpx_streaming

* test_partner_models_httpx_streaming
2025-08-25 17:39:40 -07:00
Ishaan Jaff 0fccd619ea test_vertex_ai_deepseek 2025-08-23 14:13:03 -07:00
Ishaan JaffandGitHub e93e266f84 [Performance] Use O(1) Set lookups for model routing (#13879)
* o(1) lookups

* Revert "o(1) lookups"

This reverts commit 620d14246980813366b4b1f1c0ce396b528dd9df.

* o(1) lookups

* Revert "o(1) lookups"

This reverts commit 676a9f5bcc3c2b9fa31e0a9fdf00389739b3052f.

* o(1) lookups

* register_model fix

* test_aget_valid_models

* lambda ai models fix

* test_utils.py

* test fix vertex ai
2025-08-21 22:56:46 -07:00
Ishaan JaffandGitHub 55dcaded72 [Feat] Add VertexAI qwen API Service (#13828)
* add support for vertex AI QWEN API

* streaming QWEN API support

* test_partner_models_httpx

* test_partner_models_httpx_streaming

* add cost tracking for vertex_ai/qwen/qwen3-235b-a22b-instruct-2507-maa

* docs qwen models vertexAI
2025-08-20 15:00:33 -07:00
Ishaan Jaff 12bae8fdda test_partner_models_httpx_streaming 2025-08-20 09:44:47 -07:00
Krish DholakiaandGitHub 1c8761111f Router - reduce p99 latency w/ redis enabled by 50% + OTEL - track pre_call hook latency (#13362)
* feat(proxy/utils.py): track pre-call hooks in OTEL

some pre call hooks can cause latency in high traffic - make sure this is tracked

* fix(router.py): move redis call on deployment_callback_on_success to pipeline operation

reduces p99 latency by half when redis is enabled

* fix(parallel_request_limiter_v3.py): only run check if any item has rate limits set

Prevents unnecessary latency added by rate limit checks

* test: add unit tests

* Latency Improvements: only track tpm/rpm usage when set on deployment+ LLM Caching - use an in-memory cache to reduce redis calls + OTEL - track time spent on LLM caching (#13472)

* fix(router.py): only track usage for deployments with tpm/rpm set

ensures additional latency avoided for non-tpm/rpm models

* fix(caching_handler.py): log time spent on request get cache to OTEL

enables easy debugging of call latency

* fix(caching_handler.py): use dual cache object for in-memory caching + trace redis call within caching handler

* fix(caching_handler.py): working in-memory cache for redis calls

ensures dual cache works when redis cache setup for llm calls

makes calls quicker by only checking redis when in-memory cache missed for llm api call

* test: remove redundant test

* test: add unit tests
2025-08-09 16:09:51 -07:00
Ishaan JaffandGitHub 621b3dca7b [Bug Fix] Mistral Tool Calling - Grammar error: at 3(11): failed to compile JSON schema (#13389)
* test_claude_tool_use_with_gemini

* add _remove_json_schema_refs

* add _clean_tool_schema_for_mistral

* fixes mistral tool calls

* _remove_json_schema_refs

* fix - vertex, remove hardcoded test
2025-08-07 13:50:22 -07:00
Ishaan Jaff dfada882f1 vtx test fix gemini-2.5-flash-lite 2025-08-07 00:11:10 -07:00
Ishaan Jaff eeed03a78f test fix: gcp deprecated gemini-1.5-flash 2025-08-06 08:43:45 -07:00
Ishaan Jaff 44900e781a testing fixes - vertex ai deprecated claude 3 sonnet models 2025-08-01 21:23:52 -07:00
Ishaan Jaff 9d6098e8cc fix vertex deprecated old model 2025-08-01 16:46:16 -07:00
Ishaan Jaff 1910cf8496 test fix vertex ai 2025-07-22 18:06:38 -07:00
Krish DholakiaandGitHub ab09d0621d Litellm gemini grounding metadata stream (#12673)
* fix(prompt_templates/factory.py): handle anthropic cache control on individual tool results

Fixes issue where cache control on individual tool result was being ignored

* test(test_vertex_And_google_ai_studio_gemini.py): initial unit test covering translation for grounding metadata on streaming chunk

* fix(vertex_and_google_ai_studio.py): ensure grounding metadata is preserved on streaming

Closes https://github.com/BerriAI/litellm/issues/10237

* fix(core_helpers.py): include usage in expected openai keys
2025-07-19 11:52:12 -07:00
Krrish Dholakia 8a1a90bc7a test: update test 2025-07-16 10:28:08 -07:00
Krrish Dholakia 9cac629ca6 test: update test 2025-07-16 09:13:16 -07:00
Krrish Dholakia 85fe1d35e1 test: update test, remove old gemini models 2025-07-15 22:31:49 -07:00
Krish DholakiaandGitHub 380eb31103 feat(vertex_ai/): add new deepseek-ai api service (#12312)
* feat(vertex_ai/): add new deepseek-ai api service

Closes https://github.com/BerriAI/litellm/issues/12192

* test: cleanup test
2025-07-05 10:38:37 -07:00
Ishaan JaffandGitHub 91010cda8f [Bug Fix] Add audio/ogg mapping for Audio MIME types (#11635)
* Add audio/ogg mapping

* test_vertex_ai_gemini_audio_ogg

* test_vertex_ai_gemini_audio_ogg
2025-06-11 14:19:53 -07:00
Krish DholakiaandGitHub c569056ea8 Show remaining users on UI (#11568)
* docs(deploy.md): move docker recommendation to `main-stable`

* feat(enterprise/internal_user_endpoints.py): expose endpoint for checking available premium users

* feat(usage_indictor.tsx): add new element to help track remaining premium users

* feat(usage_indicator.tsx): show premium user remaining usage

allows users with user caps to know how much is left

* fix(vertex_and_google_ai_studio_gemini.py): bubble up stream is not finished, even if stop reason is given

prevents early completion of stream

Closes https://github.com/BerriAI/litellm/issues/11549

* fix(streaming_handler.py): respect is_finished = False in hidden params

internal logic for preventing ending stream early

* fix(litellm_license.py): add function to check if user is over limit

* fix(internal_user_endpoints.py): add function to check if user is over limit

* refactor: move test

* docs(customer_endpoints.py): document new param
2025-06-09 22:04:45 -07:00
Krrish Dholakia 0c9f992af0 test: update to handle gemini-flash empty responses 2025-06-06 13:37:29 -07:00
Ishaan JaffandGitHub f0cb80ec50 [Feat] Return response_id == upstream response ID for VertexAI + Google AI studio (Stream+Non stream) (#11456)
* fix: vertexAI return responseID

* fix: vertexAI return responseID

* test_vertex_ai_response_id

* test: test_vertex_ai_streaming_response_id

* test_vertex_ai_streaming_response_id
2025-06-05 20:18:55 -07:00
Ishaan Jaff f0e0007eaf fix: gemini-2.0-flash-preview-image-generation test 2025-06-04 21:21:28 -07:00
Ishaan Jaff 7d47417906 test: fixes 2025-05-31 12:42:56 -07:00
5d4ae9aa4d Support dropping non-openai params when specified in additional_drop_params + Add VertexAI Anthropic support on /v1/messages (#11246)
* feat(utils.py): support dropping non-openai params when specified via additional drop params

Closes https://github.com/BerriAI/litellm/issues/11205

* fix(utils.py): fix linting error

* refactor(handler.py): add custom llm provider to anthropic messages provider config exception

* feat: initial commit adding vertex ai anthropic support on `/v1/messages`

* test: add working unit test

* test(vertex_ai_partner_models/anthropic): add /v1/messages support for anthropic api

Adds vertex ai auth

* feat(vertex_ai/anthropic): return correct url when calling via `/v1/messages`

* fix: more alignment to expected anthropic request format

* fix: fix ruff linting check

* Removed syntax error from docs (#11242)

* [Feat]: Add Bedrock InvokeAgents as a /chat/completions route on LiteLLM (#11239)

* feat: init structure for bedrock AGENTs

* feat: add basic  routing for bedrock AGENTs

* feat: add basic transforms for bedrock AGENTs

* fix: url for bedrock agent runtime

* fix: working agents request

* feat: working agents non-streaming request

* feat: bedrock agents

* feat: add streaming for bedrock agents

* feat: add cost tracking for bedrock agents

* docs litellm with bedrock agents

* fix: linting errors

* test: invoke agents tests

* fix: import session handling

* Revert "fix: import session handling"

This reverts commit deb257dc10.

* fix: linting pin mypy

* [Feat]: Guardrails - Add streaming for bedrock post guard (#11247)

* feat: add streaming for bedrock post guard

* fix: bedrock guardrails

* fix: add clear comments

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

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

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

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

* fix: clean up bedrock guardrails

---------

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

* [Fix] Responses API - Session management  (#11254)

* fix: import session handling

* fix: imports for session handler

* tests: tests for session handler

* Update enterprise/litellm_enterprise/enterprise_callbacks/session_handler.py

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

---------

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

* bump: bump litellm enterprise

* fixes: test_create_user_default_budget

* fix: fix linting error

* fix: fix linting error

---------

Co-authored-by: Fadil Rahman <87557055+fadil4u@users.noreply.github.com>
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-29 23:42:48 -07:00
Krish DholakiaandGitHub 7072466775 VertexAI - codeExecution tool support + anyOf handling (#11195)
* fix(vertex_and_google_ai_studio_gemini.py): handle both camel case and underscores in the tool for vertex ai code execution

support vertex ai code execution

* docs(vertex.md): add code execution example to vertex ai

* fix(vertex_ai/common_utils.py): when anyof in field, just select anyof - don't include other k,v pairs - vertex throws error

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

* fix(common_utils.py): add title field inside anyof - to retain some description

Addresses https://github.com/BerriAI/litellm/issues/11164#issuecomment-2914728385
2025-05-27 21:23:14 -07:00
Ishaan Jaff 6c36dc269b test: fix test_vertexai_model_garden_model_completion 2025-05-27 18:51:50 -07:00
86cdb8382b [Feat] Use aiohttp transport by default - 97% lower median latency (#11097)
* fix: add flag for disabling use_aiohttp_transport

* feat: add _create_async_transport

* feat: fixes for transport

* add httpx-aiohttp

* feat: fixes for transport

* refactor: fixes for transport

* build: fix deps

* fixes: test fixes

* fix: ensure aiohttp does not auto set content type

* test: test fixes

* feat: add LiteLLMAiohttpTransport

* fix: fixes for responses API handling

* test: fixes for responses API handling

* test: fixes for responses API handling

* feat: fixes for transport

* fix: base embedding handler

* test: test_async_http_handler_force_ipv4

* test: fix failing deepeval test

* fix: add YARL for bedrock urls

* fix: issues with transport

* fix: comment out linting issues

* test fix

* test: XAI is unstable

* test: fixes for using respx

* test: XAI fixes

* test: XAI fixes

* test: infinity testing fixes

* docs(config_settings.md): document param

* test: test_openai_image_edit_litellm_sdk

* test: remove deprecated test

* bump respx==0.22.0

* test: test_xai_message_name_filtering

* test: fix anthropic test after bumping httpx

* use n 4 for mapped tests (#11109)

* fix: use 1 session per event loop

* test: test_client_session_helper

* fix: linting error

* fix: resolving GET requests on httpx 0.28.1

* test fixes proxy unit tests

* fix: add ssl verify settings

* fix: proxy unit tests

* fix: refactor

* tests: basic unit tests for aiohttp transports

* tests: fixes xai

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@gmail.com>
2025-05-23 22:55:35 -07:00
Ishaan Jaff 85d843ab4d text fix vertex deprecated a model 2025-05-03 16:22:24 -07:00
Krish DholakiaandGitHub 9cc39af131 Add vertex ai meta llama 4 support + handle tool call result in content for vertex ai (#10492)
* refactor(vertex_ai/llama): handle response transformation within config

Allows us to handle https://github.com/BerriAI/litellm/issues/10441#issuecomment-2844975599

* fix(vertex_ai/llama): handle tool call in content

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

* fix(vertex_ai/llama): return 'tool_calls' as finish reason if tool call returned

vertex ai returns stop

* feat(vertex_ai/): cost tracking for vertex_ai/meta/llama-4

* ci(test-linting.yml): pin openai version

* build: reorder pinning

* ci(pyproject.toml): limit openai version

temporary patch as new version has linting errors

* ci(pyproject.toml): limit openai version

temporary patch around linting errors

* ci(limit-openai-version): temporary patch

* fix: fix linting errors

* fix: fix linting error

* fix(parallel_request_limiter_v2.py): add team based multi-instance rate limiting

* fix: fix linting errors

* build(pyproject.toml): modify pin

* ci: bump pin
2025-05-01 22:47:06 -07:00
Krish DholakiaandGitHub bf9382a182 Handle more gemini tool calling edge cases + support bedrock 'stable-image-core' (#10351)
* test(test_amazing_vertex_completion.py): try to repro https://github.com/BerriAI/litellm/issues/10319

* fix(common_utils.py): handle edge case on tools

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

* test: add unit testing for infinite loops

* fix(amazon_stability3_transformation.py): support 'stable-image-core' transformation

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

* test: add unit testing for stable image core model

* test: update test
2025-04-28 14:22:29 -07:00
Krrish Dholakia a649f10e63 test: update test to not use gemini-pro
google removed it
2025-04-23 11:31:09 -07:00
Krrish Dholakia 8184124217 test: update testing 2025-04-23 11:21:50 -07:00
Krrish Dholakia 174a1aa007 test: update test 2025-04-23 10:51:18 -07:00
Krrish Dholakia f5996b2f6b test: update test to skip 'gemini-pro' - model deprecated 2025-04-23 00:01:02 -07:00
Ishaan Jaff 257e78ffb5 test fix vertex_ai/mistral-large@2407 2025-04-16 21:52:52 -07:00
Ishaan Jaff cf801f9642 test fix vertex_ai/codestral 2025-04-16 20:01:36 -07:00