[object Object]

← back to Exo

do one request to load the model then another to check the response

7dd7ccab91a85a1ff776e416da99fd23aa79e9a0 · 2024-07-20 00:17:52 -0700 · Alex Cheema

Files touched

Diff

commit 7dd7ccab91a85a1ff776e416da99fd23aa79e9a0
Author: Alex Cheema <alexcheema123@gmail.com>
Date:   Sat Jul 20 00:17:52 2024 -0700

    do one request to load the model then another to check the response
---
 .github/workflows/test.yml | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 510116db..9d76f005 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -75,7 +75,7 @@ jobs:
       run: |
         python3 -m pip install --upgrade pip
         pip install .
-    - name: Run discovery integration test
+    - name: Run chatgpt api integration test
       run: |
         # Start first instance
         DEBUG_DISCOVERY=9 DEBUG=9 python3 main.py --listen-port 5678 --broadcast-port 5679 --chatgpt-api-port 8000 > output1.log 2>&1 &
@@ -88,30 +88,31 @@ jobs:
         # Wait for discovery
         sleep 10
 
-        curl http://localhost:8000/v1/chat/completions \
+        # first one to load the model
+        curl -s http://localhost:8000/v1/chat/completions \
+            -H "Content-Type: application/json" \
+            -d '{
+              "model": "llama-3-8b",
+              "messages": [{"role": "user", "content": "Placeholder to load model..."}],
+              "temperature": 0.7
+            }'
+
+        response=$(curl -s http://localhost:8000/v1/chat/completions \
           -H "Content-Type: application/json" \
           -d '{
             "model": "llama-3-8b",
             "messages": [{"role": "user", "content": "Who was the king of pop?"}],
             "temperature": 0.7
-          }'
+          }')
+        echo "Response: $response"
 
-        # Wait for up to 15 minutes for "exo" to appear in logs
-        timeout=900  # 15 minutes in seconds
-        start_time=$(date +%s)
-        while true; do
-          if grep -q "Michael Jackson" output1.log || grep -q "Michael Jackson" output2.log; then
-            echo "Found 'Michael Jackson' in logs"
-            break
-          fi
-          current_time=$(date +%s)
-          elapsed=$((current_time - start_time))
-          if [ $elapsed -ge $timeout ]; then
-            echo "Timeout: 'exo' not found in logs after 15 minutes"
-            exit 1
-          fi
-          sleep 10  # Check every 10 seconds
-        done
+        if ! echo "$response" | grep -q "Michael Jackson"; then
+          echo "Test failed: Response does not contain 'Michael Jackson'"
+          echo "Response: $response"
+          exit 1
+        else
+          echo "Test passed: Response contains 'Michael Jackson'"
+        fi
 
         # Stop both instances
         kill $PID1 $PID2

← 144af106 separate discovery and chatgpt api integration test  ·  back to Exo  ·  add chatgpt-api-response-timeout-secs flag, set this to 20 m e49924e1 →