When a Gemini model supports system messages, messages with the
system role get filtered out from the list of messages, so never
appended to the content (and passed as system_instructions instead).
This causes a 400 error, as both generateContent and streamGenerateContent
require contents (the systemInstruction object is optional).
This is a quick fix that does not check whether there was a system msg
or if the model supports it. It simply makes sure that if the list
of messages passed to _gemini_convert_messages_with_history()
yields no contents, that there is at least a single (empty space)
user message set to prevent the call from failing.
The potential side effect of this is that we will not fail
a call lacking any message at all, but if that needs to be checked
(and AFAIU the OpenAI spec messages are required) it should be done
elsewhere (e.g. validate_and_fix_openai_messages() @ litellm/utils.py).
PS: Applied `make format` (`poetry run black [file changed]`) only to
files changed by me. The `make lint` command identified a bunch of
files requiring formatting that I am not modifying as I did not touch
them.
- Change exception logging to debug level during shutdown cancellation
- Add clear_queue() call to process remaining coroutines during shutdown
- Prevents 'RuntimeWarning: coroutine was never awaited' messages
- Add comprehensive tests for graceful shutdown behavior
Fixes#13970
- Implemented VolcEngineEmbeddingHandler for synchronous and asynchronous embedding requests.
- Created VolcEngineEmbeddingConfig for transforming requests and responses to/from Volcengine format.
- Added integration tests for embedding functionality, covering various scenarios including error handling and parameter validation.
- Established test structure for Volcengine embedding, ensuring compliance with LiteLLM testing patterns.
- Included comprehensive tests for parameter mapping, request transformation, and response handling.
* Fix issue #13995: Handle None metadata in batch requests
- Added null check in add_key_level_controls method to prevent NoneType error
- Updated type hint to Optional[dict] for better type safety
- Added comprehensive test suite to verify the fix works correctly
- All existing tests pass, confirming no regression
Fixes#13995
Co-authored-by: openhands <openhands@all-hands.dev>
* Move test file to tests/test_litellm/proxy/ directory
- Moved test_batch_metadata_none_fix.py from tests/ to tests/test_litellm/proxy/
- Updated import structure to match existing test patterns
- This ensures the test runs in GitHub Actions as requested by @krrishdholakia
Co-authored-by: openhands <openhands@all-hands.dev>
---------
Co-authored-by: openhands <openhands@all-hands.dev>
* fix: pass extra_headers parameter through responses API transformation chain
Ensure extra_headers parameter is properly forwarded from the responses() function
through the transformation handler and config to maintain header propagation in
litellm_completion_request dict.
* Add tests
- Fix URL construction in Gemini image generation to strip 'gemini/' prefix
- Google AI API expects base model name without the prefix
- Update model references and pricing information for consistency
- Remove outdated image generation pricing entries
Fixes issue where models like 'gemini/imagen-4.0-fast-generate-preview-06-06'
were being rejected by the Google AI API due to incorrect URL formatting.