From 5393e78e3e424cc9d5025f06a1e814aad1cce91c Mon Sep 17 00:00:00 2001 From: Zheng Kai Date: Tue, 13 Jun 2023 17:44:37 +0800 Subject: [PATCH] test --- misc/test/chat-lamia.sh | 11 ----------- misc/test/chat.sh | 6 +++--- misc/test/completion.sh | 12 ++++++++++++ misc/test/curl.sh | 9 --------- 4 files changed, 15 insertions(+), 23 deletions(-) delete mode 100755 misc/test/chat-lamia.sh create mode 100755 misc/test/completion.sh delete mode 100755 misc/test/curl.sh diff --git a/misc/test/chat-lamia.sh b/misc/test/chat-lamia.sh deleted file mode 100755 index d21c33e..0000000 --- a/misc/test/chat-lamia.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -ex - -API_HOST="http://10.0.84.49:22035" - -curl "${API_HOST}/v1/chat/completions" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -d '{ - "model": "gpt-3.5-turbo", - "messages": [{"role": "user", "content": "Hello!"}] - }' diff --git a/misc/test/chat.sh b/misc/test/chat.sh index 32f055f..d851ee8 100755 --- a/misc/test/chat.sh +++ b/misc/test/chat.sh @@ -1,10 +1,10 @@ #!/bin/bash -ex -API_HOST="http://localhost:22035" +BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}" -curl "${API_HOST}/v1/chat/completions" \ +curl "${BASE}/chat/completions" \ -H "Content-Type: application/json" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Authorization: Bearer ${OPENAI_API_KEY}" \ -d '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello!"}] diff --git a/misc/test/completion.sh b/misc/test/completion.sh new file mode 100755 index 0000000..ea89d4c --- /dev/null +++ b/misc/test/completion.sh @@ -0,0 +1,12 @@ +#!/bin/bash -ex + +BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}" +curl "${BASE}/completions" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${OPENAI_API_KEY}" \ + -d '{ + "model": "text-davinci-003", + "prompt": "Say this is a test", + "max_tokens": 7, + "temperature": 0 + }' diff --git a/misc/test/curl.sh b/misc/test/curl.sh deleted file mode 100755 index f0dd9dd..0000000 --- a/misc/test/curl.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -ex - -# API_HOST="http://10.0.84.49:22035" -API_HOST="http://localhost:22035" - -curl "${API_HOST}/v1/engines/text-embedding-ada-002/embeddings" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -d '{"input":[ "\u80fd\u91cf\u793c\u7269\u662f\u600e\u4e48\u56de\u4e8b\uff1f\u7528\u4e2d\u6587"], "encoding_format": "base64"}'