File size: 1,439 Bytes
0b5e578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# Test script for all embedding models
BASE_URL="https://ipepe-nomic-embeddings.hf.space"
TEST_TEXT="Hello world test"

echo "Testing all embedding models..."
echo "================================="

# Get list of models
MODELS=$(curl -s "${BASE_URL}/models" | grep -o '"[^"]*"' | grep -E "(nomic|BAAI|sentence|Snowflake|granite|Qwen|stella|nvidia|Alibaba|intfloat)" | tr -d '"')

# Test each model
for model in $MODELS; do
    echo "Testing: $model"
    
    # Test with 30 second timeout
    response=$(timeout 30 curl -X POST "${BASE_URL}/embed" \
        -H "Content-Type: application/json" \
        -d "{\"text\": \"$TEST_TEXT\", \"model\": \"$model\"}" \
        -w "\nHTTP_STATUS:%{http_code}" \
        -s 2>/dev/null)
    
    if [ $? -eq 124 ]; then
        echo "  ❌ TIMEOUT (>30s)"
    else
        status=$(echo "$response" | grep "HTTP_STATUS" | cut -d: -f2)
        
        if [ "$status" = "200" ]; then
            # Check if response contains embedding
            if echo "$response" | grep -q '"embedding":\['; then
                echo "  ✅ SUCCESS"
            else
                echo "  ⚠️  PARTIAL - No embedding in response"
            fi
        else
            # Extract error message
            error_msg=$(echo "$response" | grep -o '"error":"[^"]*"' | cut -d'"' -f4)
            echo "  ❌ ERROR ($status): $error_msg"
        fi
    fi
    echo ""
done

echo "Testing complete!"