Spaces:
Sleeping
Sleeping
Download src/gaia/utils/verify_minimal.py from jm-vis/Final_Assignment_GAIAAgent: direct link, hf CLI and curl.
- Browser
- Download file 3.75 kB
-
https://huggingface.co/spaces/jm-vis/Final_Assignment_GAIAAgent/resolve/main/src/gaia/utils/verify_minimal.py
- Command line
-
hf download hf://spaces/jm-vis/Final_Assignment_GAIAAgent/src/gaia/utils/verify_minimal.py
-
curl -L -o verify_minimal.py https://huggingface.co/spaces/jm-vis/Final_Assignment_GAIAAgent/resolve/main/src/gaia/utils/verify_minimal.py
3.75 kB
| """ | |
| Minimal deployment verification script for GAIA Agent | |
| """ | |
| import os | |
| import sys | |
| from datetime import datetime | |
| import traceback | |
| def print_header(message): | |
| print("\n" + "=" * 50) | |
| print(message) | |
| print("=" * 50) | |
| def check_file_structure(): | |
| """Check if critical files are present.""" | |
| print_header("Checking file structure") | |
| critical_files = [ | |
| "app.py", | |
| "requirements.txt", | |
| "agent/config.py", | |
| "agent/agent.py" | |
| ] | |
| missing_files = [] | |
| for file_path in critical_files: | |
| if not os.path.exists(file_path): | |
| missing_files.append(file_path) | |
| print(f"[FAIL] Missing critical file: {file_path}") | |
| else: | |
| print(f"[PASS] Found file: {file_path}") | |
| return len(missing_files) == 0, missing_files | |
| def check_env_vars(): | |
| """Check if critical environment variables are accessible.""" | |
| print_header("Checking environment variables") | |
| critical_vars = [ | |
| "OPENAI_API_KEY", | |
| "SUPABASE_URL", | |
| "SUPABASE_KEY" | |
| ] | |
| missing_vars = [] | |
| for var_name in critical_vars: | |
| var_value = os.getenv(var_name, "") | |
| if not var_value: | |
| missing_vars.append(var_name) | |
| print(f"[FAIL] Missing environment variable: {var_name}") | |
| else: | |
| print(f"[PASS] Found environment variable: {var_name}") | |
| return len(missing_vars) == 0, missing_vars | |
| def check_packages(): | |
| """Check if requirements.txt contains critical packages.""" | |
| print_header("Checking requirements.txt packages") | |
| critical_packages = [ | |
| "openai", | |
| "gradio", | |
| "langchain" | |
| ] | |
| if not os.path.exists("requirements.txt"): | |
| print("[FAIL] requirements.txt file not found") | |
| return False, ["requirements.txt file not found"] | |
| try: | |
| with open("requirements.txt", "r") as f: | |
| content = f.read().lower() | |
| missing_packages = [] | |
| for package in critical_packages: | |
| if package.lower() not in content: | |
| missing_packages.append(package) | |
| print(f"[FAIL] Missing package in requirements.txt: {package}") | |
| else: | |
| print(f"[PASS] Found package in requirements.txt: {package}") | |
| return len(missing_packages) == 0, missing_packages | |
| except Exception as e: | |
| print(f"[ERROR] Error reading requirements.txt: {str(e)}") | |
| return False, [f"Error reading requirements.txt: {str(e)}"] | |
| def main(): | |
| """Run minimal verification checks.""" | |
| try: | |
| print_header(f"GAIA Agent Minimal Verification - {datetime.now()}") | |
| # Run checks | |
| file_check = check_file_structure() | |
| env_check = check_env_vars() | |
| pkg_check = check_packages() | |
| # Print summary | |
| print_header("Verification Summary") | |
| print(f"File structure check: {'[PASS]' if file_check[0] else '[FAIL]'}") | |
| print(f"Environment variables check: {'[PASS]' if env_check[0] else '[FAIL]'}") | |
| print(f"Package requirements check: {'[PASS]' if pkg_check[0] else '[FAIL]'}") | |
| # Overall status | |
| if file_check[0] and env_check[0] and pkg_check[0]: | |
| print("\n[SUCCESS] All checks passed. Basic deployment verification successful.") | |
| return 0 | |
| else: | |
| print("\n[FAILURE] Some checks failed. Please address the issues before deployment.") | |
| return 1 | |
| except Exception as e: | |
| print_header("ERROR OCCURRED") | |
| print(f"Error during verification: {str(e)}") | |
| print("\nTraceback:") | |
| traceback.print_exc() | |
| return 1 | |
| if __name__ == "__main__": | |
| sys.exit(main()) |