feat(tool): update web_search_aichat.sh (#166)

This commit is contained in:
sigoden
2025-02-13 20:54:49 +08:00
committed by GitHub
parent f5c3071fbc
commit 738d6d7300
+11 -4
View File
@@ -11,16 +11,23 @@ set -e
# @env WEB_SEARCH_MODEL! The model for web-searching. # @env WEB_SEARCH_MODEL! The model for web-searching.
# #
# supported aichat models: # supported aichat models:
# - gemini:gemini-2.0-*
# - vertexai:gemini-* # - vertexai:gemini-*
# - perplexity:*-online # - perplexity:*
# - ernie:* # - ernie:*
# - lingyiwanwu:yi-large-rag
# @env LLM_OUTPUT=/dev/stdout The output path # @env LLM_OUTPUT=/dev/stdout The output path
main() { main() {
client="${WEB_SEARCH_MODEL%%:*}" client="${WEB_SEARCH_MODEL%%:*}"
if [[ "$client" == "vertexai" ]]; then if [[ "$client" == "gemini" ]]; then
export AICHAT_PATCH_VERTEXAI_CHAT_COMPLETIONS='{"gemini-.*":{"body":{"tools":[{"googleSearchRetrieval":{}}]}}}' export AICHAT_PATCH_GEMINI_CHAT_COMPLETIONS='{".*":{"body":{"tools":[{"google_search":{}}]}}}'
elif [[ "$client" == "vertexai" ]]; then
export AICHAT_PATCH_VERTEXAI_CHAT_COMPLETIONS='{
"gemini-1.5-.*":{"body":{"tools":[{"googleSearchRetrieval":{}}]}},
"gemini-2.0-.*":{"body":{"tools":[{"google_search":{}}]}}
}'
elif [[ "$client" == "ernie" ]]; then
export AICHAT_PATCH_ERNIE_CHAT_COMPLETIONS='{".*":{"body":{"web_search":{"enable":true}}}}'
fi fi
aichat -m "$WEB_SEARCH_MODEL" "$argc_query" >> "$LLM_OUTPUT" aichat -m "$WEB_SEARCH_MODEL" "$argc_query" >> "$LLM_OUTPUT"
} }