fix: require openai>=2.0 and add a generic OpenAI-compatible provider - #126
Conversation
Fixes #118. The default openai-codex provider builds a Strands OpenAIResponsesModel, which raises "OpenAIResponsesModel requires openai>=2.0.0" at import time on older SDKs. Both the `openai` extra and the QGIS plugin's provider dependency group pinned only `openai>=1.0`, so a fresh install could resolve to a 1.x release and every Test Provider run failed. Raise the floor to `openai>=2.0` in both places and wrap the import so the failure explains the upgrade instead of leaking the raw ImportError. Closes #125. Add an `openai-compatible` provider that targets any server exposing the OpenAI Chat Completions API (llama.cpp, LM Studio, Text Generation WebUI, vLLM) via a generic base URL. A model id is required because a generic endpoint has no sensible default, and the API key falls back to the `EMPTY` placeholder the vLLM path already uses so keyless local servers work. - Add `openai-compatible` to ProviderName, GeoAgentConfig (`openai_compatible_base_url`), and environment-based provider detection via OPENAI_COMPATIBLE_BASE_URL. - Resolve it through Strands OpenAIModel, honoring OPENAI_COMPATIBLE_MODEL and OPENAI_COMPATIBLE_API_KEY. - Surface it in the Solara UI provider list and in the QGIS plugin (provider list, default models, credential fields, environment mapping, and settings reset). - Drop strands-vllm from GeoAgent[providers], GeoAgent[all], and the plugin's Core Providers group: it pins openai<2.0 and therefore cannot resolve alongside openai>=2.0. The standalone GeoAgent[vllm] extra is unchanged for dedicated environments, and openai-compatible reaches a vLLM server's /v1 URL with no extra dependency. - Add provider tests for both fixes and refresh the README, docs, and QGIS plugin docs.
|
Warning Review limit reached
Next review available in: 3 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code reviewBugs
Security
Performance
Quality
CLAUDE.md
|
- chat_dock.py: store `openai_compatible_api_key` env mapping as a plain string instead of a 1-tuple, matching every other single-env-var entry in `env_map`. The loop normalizes both forms, so this is style-only.
|
On the Claude review's second quality note (base_url precedence in the new |
Code reviewBugs: None found. The Security: None found. No injected input, no secrets committed; credential fields follow the existing redaction/env-fallback pattern ( Performance: None found; changes are configuration/branching only, no hot-path impact. High confidence. Quality:
CLAUDE.md: No CLAUDE.md file exists in this repository, so no project-specific guidelines apply. Overall this is a tightly scoped, well-tested PR (new provider branch, config wiring, UI wiring, docs, and 7+ new tests all move together) with a reasonable, clearly-documented tradeoff on dropping bundled |
- model.py: reword the openai-codex ImportError so it no longer asserts a single root cause. It now says an old openai package is the usual reason, and points at the chained original error when openai 2.x is already installed.
Code reviewBugs
Security
Performance
Quality
CLAUDE.md
|
Fixes #118. Closes #125.
#118 —
OpenAIResponsesModel requires openai>=2.0.0on Test ProviderThe default
openai-codexprovider builds a StrandsOpenAIResponsesModel, which validates the OpenAI SDK version at import time and raises on anything below 2.0. Both theopenaiextra and the QGIS plugin'sPROVIDER_PACKAGESpinned onlyopenai>=1.0, so a fresh install could resolve to a 1.x release and every Test Provider click failed with the rawImportErrorthe reporter screenshotted.openai>=2.0inpyproject.tomland in the plugin's dependency manager.resolve_modelso the message explains the upgrade and theopenaiprovider fallback, instead of leaking the Strands internal error.Verified on the real path:
pip install ".[providers]"into a clean venv now yields openai 2.53.0, andresolve_model(provider="openai-codex")returns anOpenAIResponsesModel.#125 — generic OpenAI-compatible endpoints
New
openai-compatibleprovider for any server exposing the OpenAI Chat Completions API — llama.cpp, LM Studio, Text Generation WebUI, vLLM.OPENAI_COMPATIBLE_BASE_URLOPENAI_COMPATIBLE_MODELOPENAI_COMPATIBLE_API_KEYA model id is required because a generic endpoint has no sensible default. The API key falls back to the
EMPTYplaceholder the vLLM path already uses, so keyless local servers work. Wired into the Solara UI and the QGIS plugin (provider list, default models, credential fields, environment mapping, settings reset).Verified with a real round trip: a local stub server received
POST /v1/chat/completionswith the configured model andAuthorization: Bearer EMPTY, and the agent returned the streamed reply.Heads-up: vLLM extra is no longer in
providers/allstrands-vllm(latest, 0.0.6) hard-pinsopenai<2.0.0, so it cannot resolve alongside theopenai>=2.0this PR requires. Leaving it inGeoAgent[providers]makes that extra uninstallable outright, so it is now excluded fromproviders,all, and the plugin's Core Providers group.GeoAgent[vllm]extra is unchanged, for dedicated environments that do not needopenai-codex.openai-compatibleprovider reaches a vLLM server's/v1URL with no extra dependency, so this is a soft landing rather than a capability loss.This is the one judgment call in the PR that has user-visible packaging impact — happy to revisit if you would rather keep vLLM bundled and solve #118 a different way.
Testing
pytest tests/— 329 passed, 2 skipped (7 new provider tests).pre-commit run --files <changed>— clean.pip install ".[providers]"and a live round trip, as described above.Note: the
deploycheck fails on pre-existing mkdocs strict-mode docstring warnings ingeoagent/core/registry.py(from 7abc595), unrelated to this branch.