Spaces:
Running
Running
Download check_setup.py from mdeep14/gaia-agent-unit4: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/spaces/mdeep14/gaia-agent-unit4/resolve/main/check_setup.py
- Command line
-
hf download hf://spaces/mdeep14/gaia-agent-unit4/check_setup.py
-
curl -L -o check_setup.py https://huggingface.co/spaces/mdeep14/gaia-agent-unit4/resolve/main/check_setup.py
1.67 kB
| """Small setup diagnostic for the local Ollama-based GAIA agent.""" | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| import requests | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| BASE_URL = os.getenv("OLLAMA_BASE_URL", "http://localhost:11434").rstrip("/") | |
| MODEL = os.getenv("OLLAMA_MODEL", "qwen3:4b").strip() | |
| def main() -> int: | |
| print("GAIA Unit 4 - Local Setup Check\n") | |
| print(f"Ollama URL: {BASE_URL}") | |
| print(f"Ollama model: {MODEL}") | |
| try: | |
| response = requests.get(f"{BASE_URL}/api/tags", timeout=5) | |
| response.raise_for_status() | |
| except Exception as exc: | |
| print(f"\n[FAIL] Ollama is not reachable: {exc}") | |
| print("Start Ollama, then run this check again.") | |
| return 1 | |
| models = [item.get("name", "") for item in response.json().get("models", [])] | |
| print("\n[OK] Ollama is running.") | |
| if not models: | |
| print("[FAIL] No Ollama models are installed.") | |
| print(f"Run: ollama pull {MODEL}") | |
| return 1 | |
| print("Installed models:") | |
| for installed in models: | |
| print(f" - {installed}") | |
| requested_base = MODEL.split(":", 1)[0] | |
| found = any( | |
| installed == MODEL | |
| or installed.removesuffix(":latest") == MODEL | |
| or installed.split(":", 1)[0] == requested_base | |
| for installed in models | |
| ) | |
| if not found: | |
| print(f"\n[FAIL] Configured model '{MODEL}' was not found.") | |
| print("Either pull it or update OLLAMA_MODEL in .env.") | |
| return 1 | |
| print(f"\n[OK] Configured model '{MODEL}' is available.") | |
| print("[OK] Basic local setup is ready.") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |