chore: add model parameter to the time_test script (#245)
default value is gpt-3.5-turbo
This commit is contained in:
parent
d383302e8a
commit
d84b0b0f5d
@ -1,13 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ $# -ne 3 ]; then
|
if [ $# -lt 3 ]; then
|
||||||
echo "Usage: time_test.sh <domain> <key> <count>"
|
echo "Usage: time_test.sh <domain> <key> <count> [<model>]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
domain=$1
|
domain=$1
|
||||||
key=$2
|
key=$2
|
||||||
count=$3
|
count=$3
|
||||||
|
model=${4:-"gpt-3.5-turbo"} # 设置默认模型为 gpt-3.5-turbo
|
||||||
|
|
||||||
total_time=0
|
total_time=0
|
||||||
times=()
|
times=()
|
||||||
|
|
||||||
@ -16,7 +18,7 @@ for ((i=1; i<=count; i++)); do
|
|||||||
https://"$domain"/v1/chat/completions \
|
https://"$domain"/v1/chat/completions \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer $key" \
|
-H "Authorization: Bearer $key" \
|
||||||
-d '{"messages": [{"content": "echo hi", "role": "user"}], "model": "gpt-3.5-turbo", "stream": false, "max_tokens": 1}')
|
-d '{"messages": [{"content": "echo hi", "role": "user"}], "model": "'"$model"'", "stream": false, "max_tokens": 1}')
|
||||||
http_code=$(echo "$result" | awk '{print $1}')
|
http_code=$(echo "$result" | awk '{print $1}')
|
||||||
time=$(echo "$result" | awk '{print $2}')
|
time=$(echo "$result" | awk '{print $2}')
|
||||||
echo "HTTP status code: $http_code, Time taken: $time"
|
echo "HTTP status code: $http_code, Time taken: $time"
|
||||||
|
Loading…
Reference in New Issue
Block a user