Commit graph

66 commits

Author SHA1 Message Date
Ishaan Jaff
5cfcf67d7c
[Feat] /chat/completions - allow using OpenAI style tools for web_search with VertexAI/gemini models (#20280)
* test_gemini_openai_web_search_tool_to_google_search

* feat: Handle OpenAI style web search tools
2026-02-02 19:36:36 -08:00
Ishaan Jaff
d2a40c8456
[Fix] - Reliability fix OOMs with image url handling (#19257)
* fix MAX_IMAGE_URL_DOWNLOAD_SIZE_MB

* test_image_exceeds_size_limit_with_content_length

* fix: _process_image_response

* add constants 50MB

* fix convert_to_anthropic_image_obj image handling

* test_gemini_image_size_limit_exceeded

* MAX_IMAGE_URL_DOWNLOAD_SIZE_MB fix

* MAX_IMAGE_URL_DOWNLOAD_SIZE_MB

* test_image_size_limit_disabled

* async_convert_url_to_base64

* docs fix

* code QA check

* fix Exception
2026-01-16 16:41:44 -08:00
Yuta Saito
34e8e97222 fix: ci test
gemini 2.5 depricated
2026-01-17 09:17:31 +09:00
Sameer Kankute
e3cf0110bb Rename: gemini-3-flash-preview 2025-12-17 21:48:15 +05:30
Sameer Kankute
22e86cde2a Add support for gemini 3 flash via v1/messages endpoint 2025-12-17 18:03:54 +05:30
Sameer Kankute
ec30032bc3 Fix nvdia and geminin tests 2025-12-10 22:05:11 +05:30
ripepersimmon
be970735de
feat: Add gemini-3-pro-image-preview model support for imageSize parameters (#17019)
- Add model identifier to FLASH_IMAGE_PREVIEW_MODEL_IDENTIFIERS
- Add imageSize parameter support (1K, 2K, 4K) with GeminiImageSize type
- Add tests for imageSize parameter transformation
- Update documentation with new model
2025-11-25 19:38:29 -08:00
Cesar Garcia
491f57a349
feat: Add support for reasoning_effort="none" for Gemini models (#16548)
Implements support for reasoning_effort="none" parameter for Gemini models,
providing significant cost savings (up to 96% cheaper) by disabling thinking
budget while maintaining response quality.

Changes:
- Added "supports_reasoning": true to gemini-2.0-flash-thinking-exp-01-21 in model config
- Implemented mapping for reasoning_effort="none" to thinkingConfig {thinkingBudget: 0, includeThoughts: false}
- Added unit test to verify the mapping works correctly

Performance impact:
- Without reasoning_effort: ~313 tokens
- With reasoning_effort="none": ~12 tokens (96% cheaper)

Closes #16420

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2025-11-12 19:41:07 -08:00
Cesar Garcia
049d45ea90
fix(gemini): Preserve non-ASCII characters in function call arguments (#16550)
Fixes #16533

Before this fix, non-ASCII characters (Japanese, Spanish, Chinese, etc.)
in function call arguments were being escaped as Unicode sequences.

Example:
- Before: "やあ" → "\u3084\u3042"
- After: "やあ" → "やあ" (preserved)

Changes:
- Add ensure_ascii=False to json.dumps() in _transform_parts()
- Add test for Japanese and Spanish Unicode character preservation

This is not a breaking change as both formats are equivalent in JSON.
The fix improves readability and aligns with OpenAI's behavior.
2025-11-12 19:01:38 -08:00
Sameer Kankute
394da34a0b
Add all gemini image models support in image generation (#16526) 2025-11-12 18:26:44 -08:00
Ishaan Jaffer
9b4e32c880 Revert "Added support for desabling thoughts by setting budget to 0 (#16347)"
This reverts commit b6f792f301.
2025-11-08 11:34:05 -08:00
Ishaan Jaffer
da7ecb3ea9 test_gemini_reasoning_effort_zero_budget_disables_thoughts 2025-11-08 11:10:54 -08:00
Ishaan Jaffer
7bf9d69007 test_gemini_reasoning_effort_env_override 2025-11-07 22:09:59 -08:00
Sameer Kankute
b6f792f301
Added support for desabling thoughts by setting budget to 0 (#16347) 2025-11-07 19:19:16 -08:00
Krish Dholakia
07ba5c1ea9
Merge branch 'main' into litellm_dev_10_10_2025_p3 2025-10-11 12:58:53 -07:00
Ishaan Jaffer
33a4676184 test fix 2025-10-11 10:05:22 -07:00
Ishaan Jaffer
c467986b8b test_gemini_context_caching_with_ttl 2025-10-11 09:20:20 -07:00
Krrish Dholakia
fed1ba2891 feat(openai/): convert chat completion tool calls to responses api
enables gpt-5-codex to work on claude code

 Closes LIT-1088
2025-10-10 19:41:11 -07:00
Krish Dholakia
12a1d081ee
Merge branch 'main' into litellm_dev_09_11_2025_p1 2025-10-08 19:02:58 -07:00
Ishaan Jaffer
be7ab0b3e3 test_gemini_url_context 2025-10-04 12:23:43 -07:00
Ishaan Jaffer
97f0f3fe32 test_gemini_finish_reason 2025-09-27 10:57:22 -07:00
Ishaan Jaffer
7236202e41 test fix 2025-09-20 09:28:15 -07:00
Krish Dholakia
0f0f4327a3
Merge pull request #14589 from timelfrink/fix/issue-14586-gemini-exception-messages
Fix: Updated error message for Gemini API
2025-09-19 23:29:21 -07:00
Tim Elfrink
5323ca8346 Fix Gemini 2.5 Flash Image Preview response parsing
- Add response_modalities configuration to request format
- Fix response parsing to use camelCase 'inlineData' instead of snake_case 'inline_data'
- Update test to validate proper request format and response parsing
- All existing Gemini image generation tests pass
2025-09-19 11:20:03 +02:00
Tim Elfrink
3a98fd6096 Remove hardcoded model name and fix breaking change
- Reverted GEMINI_2_5_FLASH_IMAGE_PREVIEW_MODEL constant usage
- Made endpoint selection conditional for gemini-2.5-flash-image-preview only
- Preserved existing Imagen models functionality with :predict endpoint
- Fixed potential breaking change that would affect 6 other Gemini image models
2025-09-19 09:29:14 +02:00
Tim Elfrink
f5e6246143 Add test for gemini-2.5-flash-image-preview fix
- Test validates correct endpoint routing to :generateContent
- Mock HTTP responses to avoid API limits
- Verify request format uses Gemini contents structure
- Ensure image generation functionality works correctly
2025-09-19 08:06:01 +02:00
Tim Elfrink
4d80a4a0fb Fix Gemini exception messages to show GeminiException
- Update exception mapping to show 'GeminiException' instead of 'VertexAIException'
- Add comprehensive HTTP status code mapping for Gemini provider (401, 403, 404, 408, 429, 500+)
- Maintain OpenAI-compatible error handling patterns
- Use LlmProviders enum constants for consistent provider identification
- Add comprehensive test coverage for Gemini exception mapping
2025-09-15 21:48:14 +02:00
Ishaan Jaff
ec32a0a7d7 fix: get_base_completion_call_args 2025-09-13 09:59:08 -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
e37c1069a1 fix test images gemini 2025-09-08 17:22:59 -07:00
Krish Dholakia
a3ffc3060e
Merge branch 'main' into litellm_dev_09_01_2025_p1 2025-09-06 18:50:49 -07:00
tobias-mayr
29bbde5257 fix condition ordering and test 2025-09-04 22:18:50 +01:00
Krrish Dholakia
6a2da54fa8 test: update tests 2025-09-01 18:51:05 -07:00
Krrish Dholakia
4b8f2dc051 test: update tests 2025-09-01 18:20:46 -07:00
Krrish Dholakia
0fbcc01173 feat(types/utils.py): support 'images' field in output
Compatible with Openrouter response format

 Closes https://github.com/BerriAI/litellm/pull/14151
2025-09-01 18:05:16 -07:00
Krrish Dholakia
b6f6dc5c1c feat(vertex_ai.py): support parsing thinking content into gemini format
allows function calls with thought signatures to be sent back to gemini

  Closes https://github.com/BerriAI/litellm/pull/13842
2025-08-30 18:49:34 -07:00
Krrish Dholakia
51c73dc60b fix(vertex_and_google_ai_studio_gemini.py): bubble up thoughtsignature back to client 2025-08-30 17:26:18 -07:00
Ishaan Jaff
c9b86775a7 test_system_message_with_no_user_message 2025-08-30 13:09:25 -07:00
Ishaan Jaff
dc6161535a fix for supports_reasoning check added in 68f4847659 2025-08-30 11:06:02 -07:00
Ishaan Jaff
3fc2198d27 fix: test_gemini_image_generation_async_stream 2025-08-30 10:33:23 -07:00
Ishaan Jaff
efebf7ec7b test_gemini_image_generation_async 2025-08-30 10:29:24 -07:00
Ishaan Jaff
04dc1a5351
[Feat] Add support for returning images with gemini/gemini-2.5-flash-image-preview with /chat/completions (#13983)
* add gemini-2.5-flash-image-preview

* add gemini-2.5-flash-image-preview

* add image in ChatCompletionResponseMessage

* test_gemini_image_generation_async

* Revert "Merge pull request #13394 from Deviad/feature/enhance_logging_for_containers"

This reverts commit 539b94ad4e, reversing
changes made to 71af7bcf9c.

* include `image` in Delta

* fix _process_candidates should show the image response

* fix: _handle_special_delta_attributes

* test_gemini_image_generation_async_stream

* image_generation_chat

* UI - allow looking at generated images from /chat/completions

* _create_streaming_choice

* fix import StreamingChoices

* fix ChatCompletionResponseMessage

* test_gemini_image_generation

* add gemini img migration

* fix _extract_candidate_metadata

* ui fix

* fix batch endpoint test
2025-08-27 16:16:19 -07:00
Ishaan Jaff
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
Krrish Dholakia
5a8762b6a1 test: update tests 2025-07-16 08:56:41 -07:00
Marcelo Díaz
094ce8f772
feat(gemini): Add custom TTL support for context caching (#9810) (#12541)
- Add ttl parameter to cache_control for Gemini models
- Support Google's TTL format (e.g., '3600s', '7200s')
- Implement robust TTL extraction and validation
- Extract TTL before system message transformation to handle all cases
- Add comprehensive test suite with 17 test cases in tests/test_litellm/
- Update documentation with TTL usage examples
- Maintain backward compatibility with existing cache_control usage

Fixes #9810
2025-07-14 22:30:54 -07:00
Ishaan Jaff
e7374e3909 test_gemini_url_context 2025-07-03 16:13:44 -07:00
Krrish Dholakia
82a0a443c6 feat(stream_chunk_builder_utils.py): correctly return web_search_requests on stream chunk builder 2025-07-03 10:56:26 -07:00
Ishaan Jaff
1aa55e6a74 test_url_context 2025-07-02 21:10:12 -07:00
Krish Dholakia
6717d67f3b
fix(streaming_handler.py): store finish reason, even if is_finished is false - allows storing early gemini finish reasons (#12250)
Fixes https://github.com/BerriAI/litellm/issues/12249
2025-07-02 12:09:41 -07:00
Krish Dholakia
22d28f5853
Batches - support batch retrieve with target model Query Param + Anthropic - completion bridge, yield content_block_stop chunk (#12228)
* fix(batches_endpoints/endpoints.py): support passing target model names for batch list as a query param

Fixes issue where cloud run fails calls because GET can't contain request body

* test(test_openai_batches_endpoints.py): add unit test

* docs(managed_batches.md): update docs

* feat(spend_tracking_utils.py): support STORE_PROMPTS_IN_SPEND_LOGS env var

ensures prompt is stored in spend logs

* fix(streaming_iterator.py): fix anthropic - completion streaming iterator to yield content block stop

ensures claude code renders messages

* test: skip local test
2025-07-01 22:13:48 -07:00