File size: 2,446 Bytes
15de73a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Setup script for Congressional Bioguide MCP Server

set -e

echo "Setting up Congressional Bioguide MCP Server..."
echo "=============================================="

# Check for compatible Python versions
PYTHON_CMD=""

# Try to find a compatible Python version (3.10-3.13)
for version in python3.13 python3.12 python3.11 python3.10; do
    if command -v $version &> /dev/null; then
        PYTHON_CMD=$version
        echo "βœ“ Found compatible Python: $($PYTHON_CMD --version)"
        break
    fi
done

# Fall back to python3 if no specific version found
if [ -z "$PYTHON_CMD" ]; then
    if command -v python3 &> /dev/null; then
        PYTHON_CMD=python3
        PYTHON_VERSION=$($PYTHON_CMD --version 2>&1 | awk '{print $2}')
        MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1)
        MINOR=$(echo $PYTHON_VERSION | cut -d. -f2)

        echo "⚠️  Found Python $PYTHON_VERSION"

        if [ "$MAJOR" -eq 3 ] && [ "$MINOR" -ge 14 ]; then
            echo ""
            echo "ERROR: Python 3.14+ is not compatible with FAISS library"
            echo ""
            echo "Please install Python 3.13 or 3.12 using pyenv:"
            echo "  brew install pyenv"
            echo "  pyenv install 3.13"
            echo "  pyenv local 3.13"
            echo "  ./setup.sh"
            echo ""
            exit 1
        elif [ "$MAJOR" -eq 3 ] && [ "$MINOR" -lt 10 ]; then
            echo "ERROR: Python 3.10 or higher required (found $PYTHON_VERSION)"
            exit 1
        fi
    else
        echo "ERROR: Python 3 not found"
        exit 1
    fi
fi

# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
    echo "Creating virtual environment with $PYTHON_CMD..."
    $PYTHON_CMD -m venv venv
    echo "βœ“ Virtual environment created"
else
    echo "βœ“ Virtual environment already exists"
fi

# Activate virtual environment
source venv/bin/activate

# Verify we're using the venv python
echo "Using Python: $(which python3)"
echo "Version: $(python3 --version)"

# Install dependencies
echo ""
echo "Installing dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
echo "βœ“ Dependencies installed"

# Run ingestion
echo ""
echo "Running data ingestion..."
python3 ingest_data.py

echo ""
echo "=============================================="
echo "βœ“ Setup complete!"
echo ""
echo "To run the server:"
echo "  source venv/bin/activate"
echo "  python3 server.py"