Conversation
…ile_content directly
batch_cost_calculator only checked the global cost map, ignoring deployment-level custom pricing (input_cost_per_token_batches etc.). Add optional model_info param through the batch cost chain and pass it from CheckBatchCost.
The test was creating fresh mocks but not fully isolating from setUp state, causing intermittent CI failures with 'Expected generation to be called once. Called 0 times.' Instead of creating fresh mocks, properly reset the existing setUp mocks to ensure clean state while maintaining proper mock chain configuration.
Add s3_use_virtual_hosted_style parameter to support AWS S3 virtual-hosted-style URL format (bucket.endpoint/key) alongside the existing path-style format (endpoint/bucket/key). This enables compatibility with S3-compatible services like MinIO and aligns with AWS S3 official terminology.
#21117) When a shared ClientSession is passed to LiteLLMAiohttpTransport, calling aclose() on the transport would close the shared session, breaking other clients still using it. Add owns_session parameter (default True for backwards compatibility) to AiohttpTransport and LiteLLMAiohttpTransport. When a shared session is provided in http_handler.py, owns_session=False is set to prevent the transport from closing a session it does not own. This aligns AiohttpTransport with the ownership pattern already used in AiohttpHandler (aiohttp_handler.py).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…issing-standard-logging-object Managed batches - Misc bug fixes
Greptile SummaryThis staging PR bundles five independent changes across the codebase:
All changes include corresponding tests and no critical issues were found. Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| litellm/integrations/s3_v2.py | Adds virtual-hosted-style URL support for S3-compatible services. URL construction logic is duplicated 3 times but follows existing pattern. Missing trailing newline at end of file. |
| litellm/llms/anthropic/chat/transformation.py | Adds effort="max" as a valid option for Claude Opus 4.6, with model-gated validation. Clean implementation that correctly reuses existing _is_claude_opus_4_6 helper. |
| litellm/llms/custom_httpx/aiohttp_transport.py | Adds owns_session parameter to prevent closing shared ClientSession instances. Default is True for backward compatibility. Clean implementation. |
| litellm/llms/custom_httpx/http_handler.py | Passes owns_session=False when using shared sessions, correctly wiring the new aiohttp_transport feature. |
| litellm/proxy/db/db_spend_update_writer.py | Removes duplicate _common_add_spend_log_transaction_to_daily_transaction call that was computing the daily transaction twice for agent spend. The common helper is still called once after the agent_id null check. |
| docs/my-website/docs/proxy/logging.md | Documents the new s3_use_virtual_hosted_style configuration option with clear description. |
| tests/test_litellm/integrations/test_langfuse.py | Improves test isolation by using setUp's shared mock objects with reset_mock() instead of creating entirely new mocks, preventing flaky failures from state pollution. |
| tests/test_litellm/integrations/test_s3_v2.py | Comprehensive mock tests for virtual-hosted-style URLs covering async upload, sync upload, download, and protocol variations. No real network calls made. |
| tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py | Adds tests for effort="max" validation for Opus 4.6 and rejection for non-Opus 4.6 models. Good coverage of the new validation logic. |
| tests/test_litellm/llms/custom_httpx/test_aiohttp_transport.py | Adds tests for owns_session behavior: shared sessions not closed, owned sessions closed, and default value is True. Uses real aiohttp sessions but no network calls. |
| tests/test_litellm/proxy/db/test_db_spend_update_writer.py | Adds test verifying the common helper is called exactly once for agent transactions, confirming the duplicate call fix. |
Flowchart
flowchart TD
subgraph S3["S3 URL Construction"]
A["S3Logger upload/download"] --> B{"s3_endpoint_url set?"}
B -->|No| C["Default AWS URL: bucket.s3.region.amazonaws.com/key"]
B -->|Yes| D{"s3_use_virtual_hosted_style?"}
D -->|True| E["Virtual-hosted: protocol://bucket.endpoint/key"]
D -->|False| F["Path-style: endpoint/bucket/key"]
end
subgraph Aiohttp["Aiohttp Session Management"]
G["AsyncHTTPHandler"] --> H{"shared_session provided?"}
H -->|Yes| I["LiteLLMAiohttpTransport\nowns_session=False"]
H -->|No| J["LiteLLMAiohttpTransport\nowns_session=True"]
I --> K["aclose() skips session.close()"]
J --> L["aclose() calls session.close()"]
end
subgraph Agent["Agent Spend Transaction"]
M["add_spend_log_to_daily_agent_txn"] --> N{"agent_id is None?"}
N -->|Yes| O["Skip - return early"]
N -->|No| P["_common_add_spend_log...\n(called once)"]
P --> Q["Queue agent spend update"]
end
Last reviewed commit: 72a1bd6
Additional Comments (2)
The file no longer ends with a newline character. Most editors and POSIX tools expect text files to end with a newline. This can also cause noise in future diffs. Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
The virtual-hosted-style and path-style URL construction block is copy-pasted identically at lines 313-326, 474-487, and 575-588. Consider extracting this into a private helper method like Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
…atements (54 > 50)
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test
Changes