Skip to content

Commit

Permalink
feat(tool): update web_search_aichat.sh (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden authored Feb 13, 2025
1 parent f5c3071 commit 738d6d7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tools/web_search_aichat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ set -e
# @env WEB_SEARCH_MODEL! The model for web-searching.
#
# supported aichat models:
# - gemini:gemini-2.0-*
# - vertexai:gemini-*
# - perplexity:*-online
# - perplexity:*
# - ernie:*
# - lingyiwanwu:yi-large-rag
# @env LLM_OUTPUT=/dev/stdout The output path

main() {
client="${WEB_SEARCH_MODEL%%:*}"
if [[ "$client" == "vertexai" ]]; then
export AICHAT_PATCH_VERTEXAI_CHAT_COMPLETIONS='{"gemini-.*":{"body":{"tools":[{"googleSearchRetrieval":{}}]}}}'
if [[ "$client" == "gemini" ]]; then
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
aichat -m "$WEB_SEARCH_MODEL" "$argc_query" >> "$LLM_OUTPUT"
}
Expand Down

0 comments on commit 738d6d7

Please sign in to comment.