feat: widen openai dependency to support 2.x for litellm compatibility#1793
feat: widen openai dependency to support 2.x for litellm compatibility#1793BV-Venky wants to merge 1 commit intostrands-agents:mainfrom
Conversation
🔴 Adversarial Testing Report for PR #1793Summary: PASS — No reproducible issues foundAdversarial Testing Result: ✅ PASS — no issues found Scope: openai version range widening (
Tests run: 131 existing + 18 adversarial tests 🔍 Key Verification Points1. OpenAI 2.0 Breaking Change AnalysisThe only breaking change in openai 2.0.0 (changelog):
Verification: ✅ Strands is NOT affected Strands uses the Chat Completions API ( # Verified in src/strands/models/openai.py
async with openai.AsyncOpenAI(**self.client_args) as client:
response = await client.chat.completions.create(**request) # ✅ Chat Completions API2. API Surface Compatibility
3. Dependency Compatibility Matrix
4. Test Results with openai 2.26.0Breakdown:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Description
Users who need LiteLLM > 1.80.10 (e.g, for SAP Generative AI Hub support) cannot install
strands-agents[litellm]because LiteLLM's core dependency to use SAP models requiresopenai>=2.8.0, while strands hasopenai<1.110.0for the litellm extra andopenai<2.0.0for the openai/sagemaker extras.This widens the
openaiversion upper bound in three optional dependency groups:litellm:openai>=1.68.0,<1.110.0→openai>=1.68.0,<3.0.0openai:openai>=1.68.0,<2.0.0→openai>=1.68.0,<3.0.0sagemaker:openai>=1.68.0,<2.0.0→openai>=1.68.0,<3.0.0The only breaking change in openai 2.0 (
ResponseFunctionToolCallOutputItem.outputtype change) affects the Responses API, which strands does not use. All existing unit tests pass with openai 2.24.0.Related Issues
Resolves #1672
Type of Change
New feature
Testing
Installed openai 2.24.0 in hatch test environment
All 2000 unit tests pass with openai 2.24.0
Verified LiteLLMModel instantiation works with openai 2.24.0 present
Reviewed openai CHANGELOG from 1.109.0 to 2.24.0; the only breaking change (ResponseFunctionToolCallOutputItem.output type) does not affect strands (uses Chat Completions API, not Responses API)
I ran
hatch run prepareChecklist