fix(providers): declare bedrock + vertex extras and add provider import-error hints#588
fix(providers): declare bedrock + vertex extras and add provider import-error hints#588Rome-1 wants to merge 2 commits into
Conversation
…rt hints (usestrix#574) Declare [project.optional-dependencies] with vertex (google-auth) and bedrock (boto3) extras so "strix-agent[vertex]" / "strix-agent[bedrock]" install the provider SDKs. Add an Installation section to the Bedrock docs mirroring Vertex, and a _provider_import_hint helper in warm_up_llm that surfaces a pip-install hint when a provider dependency is missing. Fixes usestrix#574, usestrix#573 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Greptile SummaryThis PR fixes the root cause of two reported crashes (#573, #574) by adding the previously missing
Confidence Score: 4/5The core fix is correct and additive; the only concern is a cosmetic mismatch between the runtime hint and the documented install method. The pyproject.toml fix is straightforward and directly resolves the reported crashes. The _provider_import_hint helper is well-tested and purely additive. The hint strings say pip install while the docs consistently use pipx install — a user who installed via pipx would be pointed to the wrong tool when trying to fix the missing extra. The two hint strings in strix/interface/main.py (lines 230 and 232) should be updated to match the pipx install command used in the documentation. Important Files Changed
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
strix/interface/main.py:229-232
The install command in the hint says `pip install` but the docs (and the new `bedrock.mdx` Installation section) consistently tell users to use `pipx install "strix-agent[bedrock]"`. A user who installed via pipx cannot fix the missing extra with `pip install` — that would land the package in the wrong environment. The hint should mirror the documented install command, or at minimum use `pipx inject strix-agent` which is the canonical way to add extras to a pipx-managed tool.
```suggestion
if "boto3" in message and model_name.startswith("bedrock/"):
return 'Bedrock support is optional. Install it with: pipx install "strix-agent[bedrock]"'
if "google" in message and "vertex" in model_name:
return 'Vertex AI support is optional. Install it with: pipx install "strix-agent[vertex]"'
```
Reviews (1): Last reviewed commit: "feat: add bedrock + vertex optional extr..." | Re-trigger Greptile |
| if "boto3" in message and model_name.startswith("bedrock/"): | ||
| return 'Bedrock support is optional. Install it with: pip install "strix-agent[bedrock]"' | ||
| if "google" in message and "vertex" in model_name: | ||
| return 'Vertex AI support is optional. Install it with: pip install "strix-agent[vertex]"' |
There was a problem hiding this comment.
The install command in the hint says
pip install but the docs (and the new bedrock.mdx Installation section) consistently tell users to use pipx install "strix-agent[bedrock]". A user who installed via pipx cannot fix the missing extra with pip install — that would land the package in the wrong environment. The hint should mirror the documented install command, or at minimum use pipx inject strix-agent which is the canonical way to add extras to a pipx-managed tool.
| if "boto3" in message and model_name.startswith("bedrock/"): | |
| return 'Bedrock support is optional. Install it with: pip install "strix-agent[bedrock]"' | |
| if "google" in message and "vertex" in model_name: | |
| return 'Vertex AI support is optional. Install it with: pip install "strix-agent[vertex]"' | |
| if "boto3" in message and model_name.startswith("bedrock/"): | |
| return 'Bedrock support is optional. Install it with: pipx install "strix-agent[bedrock]"' | |
| if "google" in message and "vertex" in model_name: | |
| return 'Vertex AI support is optional. Install it with: pipx install "strix-agent[vertex]"' |
Prompt To Fix With AI
This is a comment left during a code review.
Path: strix/interface/main.py
Line: 229-232
Comment:
The install command in the hint says `pip install` but the docs (and the new `bedrock.mdx` Installation section) consistently tell users to use `pipx install "strix-agent[bedrock]"`. A user who installed via pipx cannot fix the missing extra with `pip install` — that would land the package in the wrong environment. The hint should mirror the documented install command, or at minimum use `pipx inject strix-agent` which is the canonical way to add extras to a pipx-managed tool.
```suggestion
if "boto3" in message and model_name.startswith("bedrock/"):
return 'Bedrock support is optional. Install it with: pipx install "strix-agent[bedrock]"'
if "google" in message and "vertex" in model_name:
return 'Vertex AI support is optional. Install it with: pipx install "strix-agent[vertex]"'
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Good catch — switched both hints to pipx install "strix-agent[bedrock]" / [vertex] to match the docs, and updated the test assertion. Pushed.
A pipx-installed strix can't add an extra with 'pip install' (wrong env); mirror the documented 'pipx install "strix-agent[...]"' command. Addresses Greptile review.
Fixes #574
Fixes #573
The Bedrock and Vertex AI provider docs already instruct users to run
pipx install "strix-agent[bedrock]"/strix-agent[vertex], butpyproject.tomlnever declared a[project.optional-dependencies]table — so those extras don't exist and the install silently omitsboto3/google-auth. Starting a scan then crashes at LLM warm-up withImportError: Missing boto3 to call bedrock(#574) orNo module named 'google'(#573). This PR addsbedrock = ["boto3>=1.28.0"]andvertex = ["google-auth>=2.0.0"]so the documented install commands actually pull the provider SDKs, adds the previously-missing## Installationsection todocs/llm-providers/bedrock.mdx(mirroringvertex.mdx), and introduces a pure_provider_import_hint()helper that maps a missing-providerImportErrorback to the matchingpip install "strix-agent[...]"hint in the warm-up error panel. The change is purely additive — no existing behavior is altered.Testing
pytest tests/test_optional_deps.py tests/test_provider_hints.py— 6 passed. The first tomllib-parsespyproject.tomland asserts both extras pingoogle-auth/boto3; the second unit-tests_provider_import_hint(bedrock+boto3 and vertex+google-auth return apip installhint;ConnectionErrorandopenai/gpt-4returnNone). Both files fail without the source change (KeyError on the missing extras table; ImportError importing the missing helper).ruff check+ruff format --check— clean on all changed files.pyupgrade --py312-plus— no rewrites.bandit— clean onstrix/interface/main.py(only B101 assert-in-tests notices in the test files).mypyhook crashes with an internal error on the bundledopenaiSDK onmainas well, so mypy was not run as a gate here.