forked from hcompai/surfer-h-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-on-holo1-val-gpt41.sh
More file actions
executable file
·96 lines (82 loc) · 2.89 KB
/
run-on-holo1-val-gpt41.sh
File metadata and controls
executable file
·96 lines (82 loc) · 2.89 KB
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
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -euxo pipefail
echo "🚀 Starting Surfer H - Holo1 Model Run with GPT-4o Validation"
echo "=============================================================="
# Check for .env file and load environment variables
if [ -f ".env" ]; then
echo "📄 Loading environment variables from .env file..."
# Export variables from .env file (filter out comments)
# export $(grep -v '^#' .env | xargs) # use this is you want to override existing variables
while IFS='=' read -r key value; do
# Skip empty lines and comments
[[ -z "$key" || "$key" =~ ^[[:space:]]*# ]] && continue
# Only export if variable is not already set
if [[ -n "$key" && -z "${!key:-}" ]]; then
export "$key=$value"
fi
done < .env
else
echo "⚠️ Warning: .env file not found"
echo " Please create a .env file with the following variables:"
echo " HAI_API_KEY=your_hai_api_key_here"
echo " HAI_MODEL_URL=https://<api-endpoint-url>/"
echo " OPENAI_API_KEY=your_openai_api_key_here"
echo ""
fi
# Check required environment variables
echo "🔍 Checking required environment variables..."
MISSING_VARS=()
if [ -z "${HAI_API_KEY:-}" ]; then
MISSING_VARS+=("HAI_API_KEY")
fi
if [ -z "${HAI_MODEL_URL:-}" ]; then
MISSING_VARS+=("HAI_MODEL_URL")
fi
if [ -z "${OPENAI_API_KEY:-}" ]; then
MISSING_VARS+=("OPENAI_API_KEY")
fi
if [ ${#MISSING_VARS[@]} -ne 0 ]; then
echo "❌ Missing required environment variables:"
for var in "${MISSING_VARS[@]}"; do
echo " - $var"
done
echo ""
echo "Please set these variables in your .env file or export them directly:"
echo " HAI_API_KEY=your_hai_api_key_here"
echo " HAI_MODEL_URL=https://<api-endpoint-url>/"
echo " OPENAI_API_KEY=your_openai_api_key_here"
echo ""
echo "Or create a .env file with these variables."
exit 1
fi
echo "✅ All required environment variables are set"
# Sync dependencies
echo "📦 Syncing dependencies..."
uv sync
# Set up API keys for the run
export API_KEY_LOCALIZATION=${HAI_API_KEY}
export API_KEY_NAVIGATION=${HAI_API_KEY}
# Model configuration
MODEL="${HAI_MODEL_NAME:-Hcompany/Holo1-7B}"
TASK="Find a beef Wellington recipe with a rating of 4.7 or higher and at least 200 reviews."
URL="https://www.allrecipes.com"
echo "🎯 Starting task: $TASK"
echo "🌐 Target URL: $URL"
echo "🤖 Model URL: $HAI_MODEL_URL"
echo "✅ Validation: GPT-4o enabled"
echo ""
# Run the surfer-h-cli command
uv run surfer-h-cli \
--task "$TASK" \
--url "$URL" \
--max_n_steps 30 \
--base_url_localization "$HAI_MODEL_URL" \
--model_name_localization $MODEL \
--temperature_localization 0.0 \
--base_url_navigation "$HAI_MODEL_URL" \
--model_name_navigation $MODEL \
--temperature_navigation 0.7 \
--use_validator \
--model_name_validation gpt-4o-2024-08-06 \
--temperature_validation 0.0 \
"$@"