| 61 | |
| 62 | |
| 63 | def validate_environment() -> None: |
| 64 | logger.info("Validating environment") |
| 65 | console = Console() |
| 66 | missing_required_vars = [] |
| 67 | missing_optional_vars = [] |
| 68 | |
| 69 | settings = load_settings() |
| 70 | |
| 71 | if not settings.llm.model: |
| 72 | missing_required_vars.append("STRIX_LLM") |
| 73 | |
| 74 | if not settings.llm.api_key: |
| 75 | missing_optional_vars.append("LLM_API_KEY") |
| 76 | |
| 77 | if not settings.llm.api_base: |
| 78 | missing_optional_vars.append("LLM_API_BASE") |
| 79 | |
| 80 | if not settings.integrations.perplexity_api_key: |
| 81 | missing_optional_vars.append("PERPLEXITY_API_KEY") |
| 82 | |
| 83 | if missing_required_vars: |
| 84 | error_text = Text() |
| 85 | error_text.append("MISSING REQUIRED ENVIRONMENT VARIABLES", style="bold red") |
| 86 | error_text.append("\n\n", style="white") |
| 87 | |
| 88 | for var in missing_required_vars: |
| 89 | error_text.append(f"• {var}", style="bold yellow") |
| 90 | error_text.append(" is not set\n", style="white") |
| 91 | |
| 92 | if missing_optional_vars: |
| 93 | error_text.append("\nOptional environment variables:\n", style="dim white") |
| 94 | for var in missing_optional_vars: |
| 95 | error_text.append(f"• {var}", style="dim yellow") |
| 96 | error_text.append(" is not set\n", style="dim white") |
| 97 | |
| 98 | error_text.append("\nRequired environment variables:\n", style="white") |
| 99 | for var in missing_required_vars: |
| 100 | if var == "STRIX_LLM": |
| 101 | error_text.append("• ", style="white") |
| 102 | error_text.append("STRIX_LLM", style="bold cyan") |
| 103 | error_text.append( |
| 104 | " - Model name to use (e.g., 'openai/gpt-5.4' or " |
| 105 | "'anthropic/claude-opus-4-7')\n", |
| 106 | style="white", |
| 107 | ) |
| 108 | |
| 109 | if missing_optional_vars: |
| 110 | error_text.append("\nOptional environment variables:\n", style="white") |
| 111 | for var in missing_optional_vars: |
| 112 | if var == "LLM_API_KEY": |
| 113 | error_text.append("• ", style="white") |
| 114 | error_text.append("LLM_API_KEY", style="bold cyan") |
| 115 | error_text.append( |
| 116 | " - API key for the LLM provider " |
| 117 | "(not needed for local models, Vertex AI, AWS, etc.)\n", |
| 118 | style="white", |
| 119 | ) |
| 120 | elif var == "LLM_API_BASE": |