54 lines
1.7 KiB
Bash
54 lines
1.7 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# Script to set up the local test environment
|
||
|
|
|
||
|
|
# Check if Python is installed
|
||
|
|
if ! command -v python3 &> /dev/null; then
|
||
|
|
echo "Python 3 is not installed. Please install Python 3 and try again."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Create a virtual environment if it doesn't exist
|
||
|
|
if [ ! -d "venv" ]; then
|
||
|
|
echo "Creating virtual environment..."
|
||
|
|
python3 -m venv venv
|
||
|
|
if [ $? -ne 0 ]; then
|
||
|
|
echo "Failed to create virtual environment. Please check your Python installation."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
echo "Virtual environment created successfully."
|
||
|
|
else
|
||
|
|
echo "Virtual environment already exists."
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Activate the virtual environment
|
||
|
|
echo "Activating virtual environment..."
|
||
|
|
source venv/bin/activate
|
||
|
|
if [ $? -ne 0 ]; then
|
||
|
|
echo "Failed to activate virtual environment."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Install dependencies
|
||
|
|
echo "Installing dependencies..."
|
||
|
|
pip install --upgrade pip
|
||
|
|
pip install requests python-dotenv argparse
|
||
|
|
|
||
|
|
# Create local_test.env file if it doesn't exist
|
||
|
|
if [ ! -f "local_test.env" ]; then
|
||
|
|
echo "Creating local_test.env file from template..."
|
||
|
|
cp local_test.env.example local_test.env
|
||
|
|
echo "Please edit local_test.env with your server credentials."
|
||
|
|
else
|
||
|
|
echo "local_test.env file already exists."
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Make the test script executable
|
||
|
|
chmod +x test_remote_ollama.py
|
||
|
|
|
||
|
|
echo "Setup complete!"
|
||
|
|
echo "To run the test script:"
|
||
|
|
echo "1. Activate the virtual environment: source venv/bin/activate"
|
||
|
|
echo "2. Run the test script: python test_remote_ollama.py"
|
||
|
|
echo "3. To specify a different model or prompt: python test_remote_ollama.py --model llama3.3 --prompt \"Tell me about AI\""
|
||
|
|
echo "4. To specify a different Ollama URL: python test_remote_ollama.py --ollama-url http://your-server-ip:11434"
|