mirror of
https://github.com/usestrix/strix.git
synced 2026-10-11 03:37:54 +00:00
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 #574, #573 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
992 B
Python
30 lines
992 B
Python
"""Tests for the provider import-error hint helper in interface/main.py."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from strix.interface.main import _provider_import_hint
|
|
|
|
|
|
def test_bedrock_boto3_hint() -> None:
|
|
exc = ModuleNotFoundError("No module named 'boto3'")
|
|
hint = _provider_import_hint(exc, "bedrock/anthropic.claude-4-5-sonnet")
|
|
assert hint is not None
|
|
assert "pip install" in hint
|
|
assert "bedrock" in hint
|
|
|
|
|
|
def test_vertex_google_hint() -> None:
|
|
exc = ImportError("No module named 'google'")
|
|
hint = _provider_import_hint(exc, "vertex_ai/gemini-3-pro-preview")
|
|
assert hint is not None
|
|
assert "pip install" in hint
|
|
assert "vertex" in hint
|
|
|
|
|
|
def test_non_import_error_returns_none() -> None:
|
|
assert _provider_import_hint(ConnectionError("boom"), "bedrock/whatever") is None
|
|
|
|
|
|
def test_unrelated_provider_returns_none() -> None:
|
|
exc = ImportError("No module named 'something'")
|
|
assert _provider_import_hint(exc, "openai/gpt-4") is None
|