summaryrefslogtreecommitdiffstats
path: root/Argcfile.sh
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-10-03 12:34:08 +0800
committerGitHub <noreply@github.com>2024-10-03 12:34:08 +0800
commite009f2e241a7e4319240d919f76924f4316be242 (patch)
treec2881c9f19a91bef12d333a917db632a20531e9e /Argcfile.sh
parent419c626485ca045adfe6d99e5ed34ebb51524ced (diff)
downloadaichat-e009f2e241a7e4319240d919f76924f4316be242.tar.gz
feat: abandon replicate client (#900)
Diffstat (limited to 'Argcfile.sh')
-rwxr-xr-xArgcfile.sh47
1 files changed, 1 insertions, 46 deletions
diff --git a/Argcfile.sh b/Argcfile.sh
index f55f2c6..c574157 100755
--- a/Argcfile.sh
+++ b/Argcfile.sh
@@ -274,43 +274,6 @@ chat-vertexai() {
-d "$(_build_body vertexai "$@")"
}
-# @cmd Chat with replicate api
-# @env REPLICATE_API_KEY!
-# @option -m --model=meta/meta-llama-3-8b-instruct $REPLICATE_MODEL
-# @flag -S --no-stream
-# @arg text~
-chat-replicate() {
- url="https://api.replicate.com/v1/models/$argc_model/predictions"
- res="$(_wrapper curl -s "$url" \
--X POST \
--H "Authorization: Bearer $REPLICATE_API_KEY" \
--H "Content-Type: application/json" \
--d "$(_build_body replicate "$@")" \
-)"
- echo "$res"
- if [[ -n "$argc_no_stream" ]]; then
- prediction_url="$(echo "$res" | jq -r '.urls.get')"
- while true; do
- output="$(_wrapper curl -s -H "Authorization: Bearer $REPLICATE_API_KEY" "$prediction_url")"
- prediction_status=$(printf "%s" "$output" | jq -r .status)
- if [ "$prediction_status"=="succeeded" ]; then
- echo "$output"
- break
- fi
- if [ "$prediction_status"=="failed" ]; then
- exit 1
- fi
- sleep 2
- done
- else
- stream_url="$(echo "$res" | jq -r '.urls.stream')"
- _wrapper curl -i --no-buffer "$stream_url" \
--H "Accept: text/event-stream" \
-
- fi
-
-}
-
# @cmd Chat with ernie api
# @meta require-tools jq
# @env ERNIE_API_KEY!
@@ -367,7 +330,7 @@ _choice_platform() {
}
_choice_client() {
- printf "%s\n" openai gemini claude cohere ollama azure-openai vertexai bedrock cloudflare replicate ernie qianwen moonshot
+ printf "%s\n" openai gemini claude cohere ollama azure-openai vertexai bedrock cloudflare ernie qianwen moonshot
}
_choice_openai_compatible_platform() {
@@ -447,14 +410,6 @@ _build_body() {
"stream": '$stream'
}'
;;
- replicate)
- echo '{
- "stream": '$stream',
- "input": {
- "prompt": "'"$*"'"
- }
-}'
- ;;
*)
_die "Unsupported build body for $kind"
;;