Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: abandon replicate client #900

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 1 addition & 46 deletions Argcfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -445,14 +408,6 @@ _build_body() {
}
],
"stream": '$stream'
}'
;;
replicate)
echo '{
"stream": '$stream',
"input": {
"prompt": "'"$*"'"
}
}'
;;
*)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Effortlessly connect with over 20 leading LLM platforms through a unified interf
- **Perplexity:** Llama-3/Mixtral (paid, chat, online)
- **Cloudflare:** (free, chat, embedding)
- **OpenRouter:** (paid, chat, function-calling)
- **Replicate:** (paid, chat)
- **Ernie:** (paid, chat, embedding, reranker, function-calling)
- **Qianwen:** Qwen (paid, chat, embedding, vision, function-calling)
- **Moonshot:** (paid, chat, function-calling)
Expand Down
4 changes: 0 additions & 4 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ clients:
api_base: https://api-inference.huggingface.co/v1
api_key: xxx

# See https://replicate.com/docs
- type: replicate
api_key: xxx

# See https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html
- type: ernie
api_key: xxx
Expand Down
24 changes: 0 additions & 24 deletions models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -642,30 +642,6 @@
input_price: 0
output_price: 0

# Links:
# - https://replicate.com/explore
# - https://replicate.com/pricing
# - https://replicate.com/docs/reference/http#create-a-prediction-using-an-official-model
- platform: replicate
models:
- name: meta/meta-llama-3.1-405b-instruct
max_input_tokens: 128000
max_output_tokens: 4096
input_price: 9.5
output_price: 9.5
- name: meta/meta-llama-3-70b-instruct
max_input_tokens: 8192
max_output_tokens: 4096
require_max_tokens: true
input_price: 0.65
output_price: 2.75
- name: meta/meta-llama-3-8b-instruct
max_input_tokens: 8192
max_output_tokens: 4096
require_max_tokens: true
input_price: 0.05
output_price: 0.25

# Links:
# - https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Nlks5zkzu
# - https://cloud.baidu.com/doc/WENXINWORKSHOP/s/hlrk4akp7
Expand Down
2 changes: 0 additions & 2 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod message;
#[macro_use]
mod macros;
mod model;
mod prompt_format;
mod stream;

pub use crate::function::{ToolCall, ToolResults};
Expand Down Expand Up @@ -33,7 +32,6 @@ register_client!(
),
(vertexai, "vertexai", VertexAIConfig, VertexAIClient),
(bedrock, "bedrock", BedrockConfig, BedrockClient),
(replicate, "replicate", ReplicateConfig, ReplicateClient),
(ernie, "ernie", ErnieConfig, ErnieClient),
);

Expand Down
150 changes: 0 additions & 150 deletions src/client/prompt_format.rs

This file was deleted.

Loading