aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rwxr-xr-xtools/web_search_tavily.sh2
-rwxr-xr-xtools/web_search_vertexai.sh51
3 files changed, 57 insertions, 3 deletions
diff --git a/README.md b/README.md
index bdd8b1b..fca0e1e 100644
--- a/README.md
+++ b/README.md
@@ -36,9 +36,12 @@ execute_command.sh
<details>
<summary>Where is the web_search tool?</summary>
-The normal `web_search` tool does not exist. One needs to run `argc link-web-search <web-search-tool>` to link to one of the available `web_search_*` tools.
+The normal `web_search` tool does not exist. Please run `argc link-web-search <web-search-tool>` to link to one of the available `web_search_*` tools.
-![image](https://github.com/user-attachments/assets/559bebb9-fd35-4e21-b13f-29fd13b3586d)
+```
+$ argc link-web-search web_search_<tab>
+web_search_cohere.sh web_search_perplexity.sh web_search_tavily.sh web_search_vertexai.sh
+```
</details>
diff --git a/tools/web_search_tavily.sh b/tools/web_search_tavily.sh
index d80e5dd..38f5385 100755
--- a/tools/web_search_tavily.sh
+++ b/tools/web_search_tavily.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
-# @describe Perform a web search using EXA API to get up-to-date information or additional context.
+# @describe Perform a web search using Tavily API 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.
# @env TAVILY_API_KEY! The api key
diff --git a/tools/web_search_vertexai.sh b/tools/web_search_vertexai.sh
new file mode 100755
index 0000000..a1477d7
--- /dev/null
+++ b/tools/web_search_vertexai.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+set -e
+
+# @describe Perform a web search using VertexAI Gemini API 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.
+
+# @env VERTEXAI_PROJECT_ID! The project id
+# @env VERTEXAI_LOCATION! The location
+# @env VERTEXAI_WEB_SEARCH_MODEL=gemini-1.5-pro-001 The LLM model for web search
+# @option --query! The query to search for.
+# @meta require-tools gcloud
+
+main() {
+ curl -fsSL https://$VERTEXAI_LOCATION-aiplatform.googleapis.com/v1beta1/projects/$VERTEXAI_PROJECT_ID/locations/$VERTEXAI_LOCATION/publishers/google/models/$VERTEXAI_WEB_SEARCH_MODEL:generateContent \
+ -X POST \
+ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
+ -H "Content-Type: application/json" \
+ -d '
+{
+ "contents": [{
+ "role": "user",
+ "parts": [{
+ "text": "'"$argc_query"'"
+ }]
+ }],
+ "safetySettings": [
+ {
+ "category": "HARM_CATEGORY_HARASSMENT",
+ "threshold": "BLOCK_ONLY_HIGH"
+ },
+ {
+ "category": "HARM_CATEGORY_HATE_SPEECH",
+ "threshold": "BLOCK_ONLY_HIGH"
+ },
+ {
+ "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
+ "threshold": "BLOCK_ONLY_HIGH"
+ },
+ {
+ "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
+ "threshold": "BLOCK_ONLY_HIGH"
+ }
+ ],
+ "tools": [{
+ "googleSearchRetrieval": {}
+ }]
+ }' | \
+ jq -r '.candidates[0].content.parts[0].text' >> "$LLM_OUTPUT"
+}
+
+eval "$(argc --argc-eval "$0" "$@")"