#!/bin/bash # Exit on error set -e echo "Starting initialization..." # Check for required environment variables if [ -z "$GROQ_API_KEY" ]; then echo "Error: GROQ_API_KEY is not set. Please add it as a secret in your Hugging Face space settings." exit 1 fi # Install system dependencies echo "Installing system dependencies..." apt-get update && apt-get install -y \ cmake \ ninja-build \ build-essential \ git-lfs # Update pip and install dependencies echo "Updating pip and installing dependencies..." python -m pip install --upgrade pip pip install -r requirements.txt # Install Groq SDK pip install groq>=0.4.1 # Verify API keys and connectivity echo "Verifying package versions..." python check_versions.py if [ $? -ne 0 ]; then echo "Error: Package version verification failed" exit 1 fi # Configure environment if [ -z "$GROQ_API_KEY" ]; then echo "Warning: GROQ_API_KEY not set. Falling back to local models." export MODEL_BACKEND=huggingface fi if [ -z "$HUGGINGFACE_TOKEN" ]; then echo "Warning: HUGGINGFACE_TOKEN not set. Some features may be limited." fi # Set environment variables for llama-cpp-python export CMAKE_ARGS="-DLLAMA_CUBLAS=on" export FORCE_CMAKE=1 # Start the application echo "Starting Advanced Agentic System..." export PYTHONPATH="${PYTHONPATH}:${PWD}" python main.py