Repository navigation
Conversation
26360d5 to
9a18c87
Compare
|
+1 here. This is limiting for me as well. |
9a18c87 to
473f7e2
Compare
|
Hi, a gentle nudge on this one when someone has a moment. Since it was opened, apache/airflow#73511 (merged 22 Sep) has had to hold openai on 2.x in its lockfile and CI image because of this package's The CI workflows are still waiting for approval, since this is my first contribution to the repo, so only the new-pyproject check has run. If a maintainer could approve the runs, I'm happy to fix anything they turn up, and to rebase or re-bump the version if The companion test-coverage PR, #22938, is in the same state. |
473f7e2 to
64be5a9
Compare
|
Needed this for sure on my project! |
|
@logan-markewich could you take a look when you have a moment? openai<3 here is now the only thing holding downstream projects on openai 2.x. pydantic-ai-slim ≥2.52, which carries two HIGH security fixes (GHSA-6fqq-452j-qhrp), requires openai>=3.19, so anyone using both packages can't take that fix. We've confirmed in our lock that lifting this cap is the only conflict. Thank you. |
The `openai<3` cap was added in 0.7.0 (March 2026), five months before openai 3.0.0 shipped, so it was a routine next-major cap rather than a reaction to a known incompatibility. openai 3.x has been out since August 2026 and the package still works against it. Testing against openai 3.7.0 with the cap removed: * The full package suite passes on both openai 2.54.0 and 3.7.0, including the API-backed tests, which cover streaming, async streaming, structured prediction, built-in tools and file upload. * All type and client import paths the package uses still resolve, and no parameter it passes has been removed. * openai 3.0.0's one documented breaking change is the move to HTTPX2. The package never constructs a transport itself, it only forwards an optional `http_client`, and openai 3 accepts both client families. Requests, including streaming, succeed either way. One test needed updating. `ResponseOutputTextAnnotationAddedEvent.annotation` was typed as a bare `object` in openai 2 and is a discriminated union in openai 3, so the fixture's placeholder payload no longer validates. It now uses a real annotation and normalises the stored value, which works on both majors. No library code required changes. Claude-Session: https://claude.ai/code/session_01YDFeREeB9bZQ3aeuKfJses
64be5a9 to
8acfb5e
Compare
Description
Removes the
openai<3upper bound fromllama-index-llms-openai, allowingopenai>=1.108.1.Why I am raising this. I want to use a 3.x release of the
openaiSDK in one of my projects, and I currently cannot: this package pinsopenai<3, and because it is pulled in transitively (in my case viaOpenAILike), the resolver refuses the newer SDK for the whole environment. Rather than just ask for the bump, I did the testing to check the package actually handles it, and this PR is the result.The cap looks precautionary rather than reactive. It was introduced in 0.7.0 on 2026-03-12, and openai 3.0.0 shipped on 2026-08-12, five months later. So it was a routine next-major bound in the same style as the
llama-index-core<0.15pin, not a response to a known incompatibility. I could not find an existing issue or PR proposing 3.x support.What I checked
Against
openai==3.7.0, withopenai==2.54.0as the baseline for comparison:OPENAI_API_KEYis unset. Those cover chat, completion, sync and async streaming, structured prediction, built-in tools and document upload, so the real serialisation path is exercised, not only mocks.openaiimport path the package uses still resolves, including all of theopenai.types.responsesandopenai.types.chatsymbols inbase.pyandresponses.py, and the four exception typesutils.pyretries on. Nothing the package references was removed or moved.chat.completions.create,completions.create,responses.create,responses.parse) or from the client constructors.http_client/async_http_client. openai 3 accepts both anhttpxand anhttpx2client, and requests succeed through either, including streaming.The one test change
ResponseOutputTextAnnotationAddedEvent.annotationwas typed as a bareobjectin openai 2 and is a discriminated union of annotation models in openai 3.test_process_response_event_with_text_annotationbuilt a placeholder{"type": "test_annotation", "value": 42}payload, which only validated because the field previously accepted anything.The test now uses a real
url_citationannotation and normalises the stored value, since openai 2 leaves it as a dict while openai 3 parses it into a model. It passes on both majors. The library code needed no change:process_response_eventappends the annotation without inspecting it.One thing worth flagging separately
base.pyandresponses.pybothimport httpxat module scope, but the package does not declarehttpxas a dependency. Under openai 2 this was masked because openai installedhttpxitself. openai 3 depends onhttpx2instead, so after this change the import survives only becausellama-index-corehappens to declarehttpx.I have deliberately not bundled a fix here, because the right answer may be to accept both client families rather than to adopt a dependency the SDK is moving away from, and that is a maintainer call. Happy to open a separate issue or PR for it, whichever you prefer.
Fixes # (no issue)
New Package?
Version Bump?
Type of Change
How Has This Been Tested?
The existing suite was run in full against both
openai==2.54.0andopenai==3.7.0.Note that CI does not set
OPENAI_API_KEY, so the API-backed tests are skipped there. I ran them locally with my own key, on both majors, which is what gives me confidence the change is safe beyond the mocked paths. I have opened #22938 separately to add coverage for some untested areas, includinghttp_client, which is the surface this change touches most directly. That PR is independent of this one and passes on the current pinned range, but it would make this change better covered if merged first.Suggested Checklist:
ruff checkandruff format --checkboth clean for the touched files)AI assistance disclosure
Per the "How to Use AI when Contributing" section of CONTRIBUTING.md: this change was investigated with AI assistance. The conclusions are backed by actual test runs against both openai majors rather than by model inspection alone, including the live API-backed tests, and the SDK comparison was done by diffing the installed packages and reading the upstream diff between the two versions.