Skip to content

Commit

Permalink
feat(tool): add web_search_aichat.sh (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden authored Nov 2, 2024
1 parent 68b1f57 commit 3573a43
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 78 deletions.
32 changes: 32 additions & 0 deletions tools/web_search_aichat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e

# @describe Perform a web search to get up-to-date information or additional context.
# Use this when you need current information or feel a search could provide a better answer.

# @option --query! The query to search for.

# @meta require-tools aichat
# @env WEB_SEARCH_MODEL! The model for web-searching.
#
# supported aichat models:
# - cohere:*
# - vertexai:gemini-*
# - perplexity:*-online
# - ernie:*
# - lingyiwanwu:yi-large-rag

main() {
client="${WEB_SEARCH_MODEL%%:*}"
case "$client" in
cohere)
export AICHAT_PATCH_COHERE_CHAT_COMPLETIONS='{".*":{"body":{"connectors":[{"id":"web-search"}]}}}'
;;
vertexai)
export AICHAT_PATCH_VERTEXAI_CHAT_COMPLETIONS='{"gemini-.*":{"body":{"tools":[{"googleSearchRetrieval":{}}]}}}'
;;
esac
aichat -m "$WEB_SEARCH_MODEL" "$argc_query" >> "$LLM_OUTPUT"
}

eval "$(argc --argc-eval "$0" "$@")"
27 changes: 0 additions & 27 deletions tools/web_search_cohere.sh

This file was deleted.

51 changes: 0 additions & 51 deletions tools/web_search_vertexai.sh

This file was deleted.

0 comments on commit 3573a43

Please sign in to comment.