Skip to content

Commit d84b0b0

Browse files
authored
chore: add model parameter to the time_test script (songquanpeng#245)
default value is gpt-3.5-turbo
1 parent d383302 commit d84b0b0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bin/time_test.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22

3-
if [ $# -ne 3 ]; then
4-
echo "Usage: time_test.sh <domain> <key> <count>"
3+
if [ $# -lt 3 ]; then
4+
echo "Usage: time_test.sh <domain> <key> <count> [<model>]"
55
exit 1
66
fi
77

88
domain=$1
99
key=$2
1010
count=$3
11+
model=${4:-"gpt-3.5-turbo"} # 设置默认模型为 gpt-3.5-turbo
12+
1113
total_time=0
1214
times=()
1315

@@ -16,7 +18,7 @@ for ((i=1; i<=count; i++)); do
1618
https://"$domain"/v1/chat/completions \
1719
-H "Content-Type: application/json" \
1820
-H "Authorization: Bearer $key" \
19-
-d '{"messages": [{"content": "echo hi", "role": "user"}], "model": "gpt-3.5-turbo", "stream": false, "max_tokens": 1}')
21+
-d '{"messages": [{"content": "echo hi", "role": "user"}], "model": "'"$model"'", "stream": false, "max_tokens": 1}')
2022
http_code=$(echo "$result" | awk '{print $1}')
2123
time=$(echo "$result" | awk '{print $2}')
2224
echo "HTTP status code: $http_code, Time taken: $time"

0 commit comments

Comments
 (0)