Fix/litellm custom provider override#2344
Fix/litellm custom provider override#2344Taooo-habitus wants to merge 13 commits intoThe-PR-Agent:mainfrom
Conversation
Review Summary by QodoAdd LiteLLM custom provider override and configurable streaming support
WalkthroughsDescription• Add support for LITELLM__CUSTOM_LLM_PROVIDER to preserve raw model IDs • Implement configurable forced streaming for OpenAI-compatible endpoints • Add validation and normalization for streaming configuration settings • Comprehensive test coverage for custom provider and streaming behavior Diagramflowchart LR
A["chat_completion"] -->|reads custom_llm_provider| B["kwargs setup"]
B -->|passes to| C["_get_completion"]
C -->|checks force_streaming config| D["Streaming Decision"]
D -->|matches provider & api_base| E["Enable Streaming"]
D -->|no match| F["Standard Response"]
E -->|handles| G["_handle_streaming_response"]
F -->|handles| H["acompletion"]
File Changes1. pr_agent/algo/ai_handlers/litellm_ai_handler.py
|
Code Review by Qodo
1.
|
|
Persistent review updated to latest commit 5a9ebe2 |
|
Persistent review updated to latest commit 60d52db |
|
Persistent review updated to latest commit 9b9cb64 |
This came out of trying to run PR-Agent against Snowflake Cortex through its OpenAI-compatible API.
The main change is adding support for LITELLM__CUSTOM_LLM_PROVIDER, so PR-Agent can keep raw hosted model IDs like claude-sonnet-4-5 while still telling LiteLLM which provider path to use.
I also added a small Snowflake-specific streaming workaround. In my testing, non-streaming responses on the Cortex OpenAI-compatible endpoint could trip LiteLLM response normalization, so forcing streaming for that path avoids the failure.