Skip to content

build: widen openai floor to >=2.7#142

Merged
ayushag-nv merged 2 commits into
mainfrom
chore/widen-openai-floor
Jul 24, 2026
Merged

build: widen openai floor to >=2.7#142
ayushag-nv merged 2 commits into
mainfrom
chore/widen-openai-floor

Conversation

@linj-glitch

@linj-glitch linj-glitch commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

In order to integrate into Gym, we need to widen the openai floor

What

Lowers the openai dependency floor from >=2.34.0 to >=2.7. The upper bound at the major version is unchanged, and the resolved version stays 2.34.0 — this only widens what consumers are allowed to bring.

Why

The floor was set to whatever version was current when the package metadata was written, not to a version the code needs. The same pattern shows in its neighbours: every floor equals its locked version (openai 2.34.0/2.34.0, pydantic 2.13.3/2.13.3, httpx 0.28.1/0.28.1).

It has a concrete downstream cost. NeMo Gym pins openai<=2.7.2, so adding nemo-switchyard to Gym is unsatisfiable today:

Because nemo-switchyard==0.1.0 depends on openai>=2.34.0,<3.0 and your
project depends on openai<=2.7.2, we can conclude that your project's
requirements are unsatisfiable.

That blocks the Gym <> Switchyard integration — Gym needs to launch the proxy for router evals and, later, to import Switchyard for schema mapping. Fixing it from Gym's side instead would mean migrating Gym's openai SDK across ~27 minor versions, touching ~10 core modules that import internal type paths (openai.types.responses.response_create_params, response_output_text_param, shared.chat_model, …). Relaxing an over-tight floor here is the cheaper and more accurate fix.

>=2.7 rather than lower is deliberate: it is the narrowest floor that overlaps Gym's ceiling, so the supported range grows no more than it has to.

Verification

Switchyard uses openai for request/response schema types plus the async client in lib/llm_client.py. Two checks:

  1. Import surface — every openai symbol imported anywhere in switchyard/ resolves on 2.7.0, including openai.types.chat.chat_completion_message_function_tool_call, which was the one I expected to be version-gated. Zero missing modules or symbols.
  2. Test suite — the Python suite at tag v0.1.0, run against the published nemo-switchyard[server]==0.1.0 wheel, is identical across every version tested:
openai result
2.7.0 69 passed, 1 failed
2.7.1 69 passed, 1 failed
2.7.2 69 passed, 1 failed
2.34.0 69 passed, 1 failed
2.48.0 69 passed, 1 failed

The single failure is test_build_and_serve_registers_extra_endpoints, identical in all runs — an artifact of running the tests against the installed wheel rather than the source tree, not an openai regression. e2e, contract, getting_started and readme were excluded (network / docs deps).

For what it's worth the suite also passes on 2.0.0, 2.2.0 and 2.5.0, so 2.7 is a policy choice rather than a limit of the code. Happy to drop it further if reviewers prefer.

uv lock --check passes.

Follow-up

Once this ships in a release, adding nemo-switchyard to NeMo Gym becomes a one-line change scoped to the Switchyard model server package, rather than a change to Gym's core dependencies.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Expanded compatibility to support a broader range of OpenAI library versions.
    • Added documentation clarifying the supported version range.

linj-glitch and others added 2 commits July 24, 2026 16:44
The floor was pinned at the version that happened to be current when the
package metadata was written, not at a version the code actually needs.
It blocks downstream consumers: NeMo Gym pins openai<=2.7.2, so adding
nemo-switchyard to Gym is unsatisfiable today.

Switchyard uses openai for request/response schema types and the async
client in lib/llm_client.py. Every symbol imported resolves on 2.0.0, and
the Python suite at v0.1.0 passes identically on 2.0.0, 2.2.0, 2.5.0,
2.7.2, 2.34.0 and 2.48.0 (69 passed in all six runs). The upper bound at
the major version is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Lin Jia <linj@nvidia.com>
Lowering the floor all the way to 2.0.0 was more than the motivating case
needs. NeMo Gym pins openai<=2.7.2, so >=2.7 is enough to make the two
co-installable while keeping the supported range that much narrower.

The suite at v0.1.0 passes identically on 2.7.0, 2.7.1 and 2.7.2 as it
does on 2.34.0 and 2.48.0 (69 passed in every run).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Lin Jia <linj@nvidia.com>
@linj-glitch
linj-glitch requested a review from a team as a code owner July 24, 2026 23:52
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-142/

Built to branch gh-pages at 2026-07-24 23:53 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 63a594f9-cd86-47b6-b0ba-4cbe243792a6

📥 Commits

Reviewing files that changed from the base of the PR and between 9a43930 and 4c62174.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock, !uv.lock
📒 Files selected for processing (1)
  • pyproject.toml

Walkthrough

The project’s OpenAI dependency floor changes from version 2.34.0 to 2.7, while the <3.0 upper bound remains unchanged. Inline comments document the supported compatibility range.

Changes

OpenAI Compatibility

Layer / File(s) Summary
OpenAI dependency range
pyproject.toml
The minimum OpenAI version is lowered to 2.7, the major-version cap remains below 3.0, and compatibility comments are added.

Estimated code review effort: 2 (Simple) | ~5 minutes

Poem

I’m a rabbit with a package to tune,
Lowering the floor beneath the moon.
Two point seven hops right in,
Three stays out with a guarded grin.
Comments bloom—what a tidy burrow!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: lowering the OpenAI dependency floor to 2.7.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@ayushag-nv
ayushag-nv merged commit 64eaa61 into main Jul 24, 2026
22 checks passed
@ayushag-nv
ayushag-nv deleted the chore/widen-openai-floor branch July 24, 2026 23:58
linj-glitch added a commit to NVIDIA-NeMo/Gym that referenced this pull request Jul 25, 2026
Users had to run pip install themselves before launch mode would work. Gym
already creates a virtual environment per server and installs that server's
pyproject into it, so declaring the dependency here removes the manual step
without putting Switchyard anywhere near Gym's core dependencies.

The published nemo-switchyard 0.1.0 declares openai>=2.34.0, which Gym's
openai<=2.7.2 cannot satisfy. That floor was never a real requirement -- the
suite at v0.1.0 passes identically on 2.7.0 through 2.48.0 -- and it was widened
in NVIDIA-NeMo/Switchyard#142, but PyPI releases are immutable so the published
artifact keeps the old metadata. A uv override neutralizes it.

The override restates Gym's own openai pin rather than expressing a preference
of its own, so the resolved openai is whatever Gym would have resolved anyway
(2.7.2, verified). Overrides apply to every requirement for a package, not just
the offending one, so omitting the ceiling would erase Gym's own and pull in a
far newer openai than Gym is tested against.

nemo-switchyard is pinned exactly, since the override asserts something about
one specific published artifact. Both come out once a release with the widened
floor ships.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Lin Jia <linj@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants