From 67ccfaed399f85013eb3cf64bae08b6261ba7c38 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:10:38 -0700 Subject: [PATCH] =?UTF-8?q?simplify(compat):=20image=5Fgeneration=5Ftool?= =?UTF-8?q?=20=E2=80=94=20drop=202=20re-export=20noqa=20blocks=20(13=20nam?= =?UTF-8?q?es),=20repoint=202=20callers=20+=202=20tests=20to=20image=5Fgen?= =?UTF-8?q?eration=5Fcatalog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hermes_cli/tools_config_providers.py | 4 ++-- plugins/image_gen/fal/__init__.py | 8 ++++---- tests/plugins/image_gen/test_fal_provider.py | 4 ++-- tests/tools/test_image_generation_image_to_image.py | 2 +- tools/image_generation_tool.py | 5 ++--- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hermes_cli/tools_config_providers.py b/hermes_cli/tools_config_providers.py index bf7f524f10..3f1a587088 100644 --- a/hermes_cli/tools_config_providers.py +++ b/hermes_cli/tools_config_providers.py @@ -479,8 +479,8 @@ def _detect_active_provider_index(providers: list, config: dict, *, force_fresh: def _fal_model_catalog(): - """Lazy-load the FAL model catalog from the tool module.""" - from tools.image_generation_tool import FAL_MODELS, DEFAULT_MODEL + """Lazy-load the FAL model catalog.""" + from tools.image_generation_catalog import FAL_MODELS, DEFAULT_MODEL return FAL_MODELS, DEFAULT_MODEL diff --git a/plugins/image_gen/fal/__init__.py b/plugins/image_gen/fal/__init__.py index 9b9be919ca..ba884373c7 100644 --- a/plugins/image_gen/fal/__init__.py +++ b/plugins/image_gen/fal/__init__.py @@ -38,12 +38,12 @@ class FalImageGenProvider(StaticImageGenProvider): return False def list_models(self) -> List[Dict[str, Any]]: - import tools.image_generation_tool as _it - return catalog_rows(_it.FAL_MODELS) + from tools.image_generation_catalog import FAL_MODELS + return catalog_rows(FAL_MODELS) def default_model(self) -> Optional[str]: - import tools.image_generation_tool as _it - return _it.DEFAULT_MODEL + from tools.image_generation_catalog import DEFAULT_MODEL + return DEFAULT_MODEL def capabilities(self) -> Dict[str, Any]: # Image-to-image depends on the selected model (``edit_endpoint``); upscale works for any. diff --git a/tests/plugins/image_gen/test_fal_provider.py b/tests/plugins/image_gen/test_fal_provider.py index 083c1bedad..7f41688063 100644 --- a/tests/plugins/image_gen/test_fal_provider.py +++ b/tests/plugins/image_gen/test_fal_provider.py @@ -35,13 +35,13 @@ class TestFalImageGenProviderSurface: def test_default_model_matches_legacy(self): from plugins.image_gen.fal import FalImageGenProvider - from tools.image_generation_tool import DEFAULT_MODEL + from tools.image_generation_catalog import DEFAULT_MODEL assert FalImageGenProvider().default_model() == DEFAULT_MODEL def test_list_models_uses_legacy_catalog(self): from plugins.image_gen.fal import FalImageGenProvider - from tools.image_generation_tool import FAL_MODELS + from tools.image_generation_catalog import FAL_MODELS provider = FalImageGenProvider() models = provider.list_models() diff --git a/tests/tools/test_image_generation_image_to_image.py b/tests/tools/test_image_generation_image_to_image.py index 6bfa308929..5dd3ea7591 100644 --- a/tests/tools/test_image_generation_image_to_image.py +++ b/tests/tools/test_image_generation_image_to_image.py @@ -60,7 +60,7 @@ class TestFalEditPayload: def test_text_only_model_has_no_edit_endpoint(self): - from tools.image_generation_tool import FAL_MODELS + from tools.image_generation_catalog import FAL_MODELS # z-image/turbo is a pure text-to-image model — no edit endpoint. assert "edit_endpoint" not in FAL_MODELS["fal-ai/z-image/turbo"] diff --git a/tools/image_generation_tool.py b/tools/image_generation_tool.py index bc9d3fc5f5..b72e9ca766 100644 --- a/tools/image_generation_tool.py +++ b/tools/image_generation_tool.py @@ -29,9 +29,8 @@ def _load_fal_client() -> Any: from tools.debug_helpers import DebugSession -from tools.fal_common import ( # noqa: F401 — _normalize_fal_queue_url_format re-exported for tests - _ManagedFalSyncClient, _extract_http_status, _normalize_fal_queue_url_format) -from tools.image_generation_catalog import ( # noqa: F401 — re-exported (plugins/tests/tools_config) +from tools.fal_common import _ManagedFalSyncClient, _extract_http_status, _normalize_fal_queue_url_format +from tools.image_generation_catalog import ( DEFAULT_ASPECT_RATIO, DEFAULT_MODEL, FAL_MODELS, UPSCALER_CREATIVITY, UPSCALER_DEFAULT_PROMPT, UPSCALER_FACTOR, UPSCALER_GUIDANCE_SCALE, UPSCALER_MODEL, UPSCALER_NEGATIVE_PROMPT, UPSCALER_NUM_INFERENCE_STEPS, UPSCALER_RESEMBLANCE, UPSCALER_SAFETY_CHECKER, VALID_ASPECT_RATIOS,