fix: release 0.7.4 with openai as a base dependency - #209
Conversation
PyPI vlmrun 0.7.3 imports openai in the CLI but only declares it as an optional extra, causing ModuleNotFoundError on uvx vlmrun@latest. - Lazy-load openai in chat CLI error handling and agent completions - Add regression test ensuring vlmrun --version works without openai - Bump version to 0.7.4 for release (openai>=1.0.0 already in base deps) Co-authored-by: Sudeep Pillai <sudeep.pillai@gmail.com>
| openai = require_openai() | ||
| AuthenticationError = openai.AuthenticationError | ||
| RateLimitError = openai.RateLimitError | ||
| APIConnectionError = openai.APIConnectionError | ||
| APIError = openai.APIError |
There was a problem hiding this comment.
🟡 Chat and gateway commands crash with a raw traceback when the OpenAI package is missing
The error handler tries to load the OpenAI package (require_openai() at vlmrun/cli/_cli/chat.py:44) before it decides how to report a failure, so when that package is absent the command aborts with an unhandled traceback instead of the friendly error panel.
Impact: Users without the OpenAI package see a confusing stack trace rather than a clear message and clean exit code.
Missing dependency raised while handling an exception replaces the original error
handle_api_errors.__exit__ is entered whenever a wrapped call fails (used at vlmrun/cli/_cli/chat.py:753, vlmrun/cli/_cli/chat.py:765, vlmrun/cli/_cli/chat.py:823, and in vlmrun/cli/_cli/gateway.py:369 etc.). If openai cannot be imported, require_openai() raises DependencyError (vlmrun/common/dependencies.py:24-30) from inside __exit__, which propagates out of the with block and suppresses/masks the original exception (e.g. the DependencyError raised lazily by Agent.completions at vlmrun/client/agent.py:310). None of the Panel messages are printed and typer.Exit(1) is never raised, so the CLI terminates with a traceback. Given this PR exists precisely to keep the CLI usable when openai is unavailable, the fallback should catch the import failure and use the generic "Unexpected Error" path.
| openai = require_openai() | |
| AuthenticationError = openai.AuthenticationError | |
| RateLimitError = openai.RateLimitError | |
| APIConnectionError = openai.APIConnectionError | |
| APIError = openai.APIError | |
| try: | |
| openai = require_openai() | |
| except Exception: | |
| console.print( | |
| Panel( | |
| str(exc_val), | |
| title="[red]Unexpected Error[/red]", | |
| title_align="left", | |
| border_style="red", | |
| ) | |
| ) | |
| raise typer.Exit(1) | |
| AuthenticationError = openai.AuthenticationError | |
| RateLimitError = openai.RateLimitError | |
| APIConnectionError = openai.APIConnectionError | |
| APIError = openai.APIError |
Was this helpful? React with 👍 or 👎 to provide feedback.
|
|
||
| from vlmrun.client import VLMRun | ||
| from vlmrun.client.types import AgentSkill, AgentToolset, FileResponse | ||
| from vlmrun.common.dependencies import require_openai |
There was a problem hiding this comment.
Revert this, and simply use the old import way
spillai
left a comment
There was a problem hiding this comment.
Review the comments.
|
@cursoragent, please followup |
|
Addressed the PR review feedback in PR #209. Changes made per review:
What the PR does now: Tests pass (134 passed). Ready for merge and release. |
|
PR review feedback is already addressed on the branch. Here's the status: Done in
What the PR does now: Also updated:
PR #209 is ready to merge and release. |
Per review feedback, keep direct openai imports in agent.py and chat.py. The fix is releasing 0.7.4 with openai>=1.0.0 in base dependencies (already in requirements.txt from #208). Co-authored-by: Sudeep Pillai <sudeep.pillai@gmail.com>
Cool. While at it, please fix the failing test. @cursoragent |
|
Addressed review feedback in 42f8bc7:
The PR is now a minimal 0.7.4 version bump to ship the |
|
Looks good |


Summary
Fixes
ModuleNotFoundError: No module named 'openai'when runninguvx vlmrun@latest --version.Root cause
PyPI
vlmrun==0.7.3importsopenaiat CLI startup (chat.py,agent.py) but only declares it under optional extras (cli,openai,all). PR #208 movedopenai>=1.0.0into base dependencies onmain, but that change was never released.Changes
openai>=1.0.0in base deps (already present inrequirements/requirements.txtfrom Slim core dependencies; promote openai to base install #208)from openai import ...imports inagent.pyandchat.py(per review feedback)Testing
python3 -m pytest -sv tests/cli/test_cli_chat.py tests/common/test_dependencies.py tests/test_gateway.pyRelease note
After merging, publish
0.7.4to PyPI souvx vlmrun@latestinstallsopenaiautomatically.Slack Thread