diff --git a/src/smarttools/providers.py b/src/smarttools/providers.py index 731932a..5097884 100644 --- a/src/smarttools/providers.py +++ b/src/smarttools/providers.py @@ -174,7 +174,7 @@ def call_provider(provider_name: str, prompt: str, timeout: int = 300) -> Provid return ProviderResult( text="", success=False, - error=f"Command '{base_cmd}' not found. Is it installed and in PATH?" + error=f"Command '{base_cmd}' not found. Is it installed and in PATH?\n\nTo install AI providers, run: smarttools providers install" ) try: @@ -188,10 +188,22 @@ def call_provider(provider_name: str, prompt: str, timeout: int = 300) -> Provid ) if result.returncode != 0: + error_msg = f"Provider exited with code {result.returncode}: {result.stderr}" + if "not found" in result.stderr.lower() or "not installed" in result.stderr.lower(): + error_msg += "\n\nTo install AI providers, run: smarttools providers install" return ProviderResult( text="", success=False, - error=f"Provider exited with code {result.returncode}: {result.stderr}" + error=error_msg + ) + + # Warn if output is empty (provider ran but returned nothing) + if not result.stdout.strip(): + stderr_hint = f" (stderr: {result.stderr.strip()})" if result.stderr.strip() else "" + return ProviderResult( + text="", + success=False, + error=f"Provider returned empty output{stderr_hint}.\n\nThis may mean the model is not available. Try a different provider or run: smarttools providers install" ) return ProviderResult(text=result.stdout, success=True)