From f2d2d3139c597eb53479b6beb268f02e38a7a49c Mon Sep 17 00:00:00 2001 From: 0fflineuser <0fflineuser@cock.li> Date: Fri, 26 Sep 2025 11:12:39 +0200 Subject: [PATCH] feat(ollama_web_search.sh): Added tool for web search with ollama --- tools/web_search_ollama.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tools/web_search_ollama.sh diff --git a/tools/web_search_ollama.sh b/tools/web_search_ollama.sh new file mode 100755 index 0000000..12e930c --- /dev/null +++ b/tools/web_search_ollama.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -e + +# @describe Perform a web search using Ollama 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. + +# @option --query! The query to search for. + +# @env OLLAMA_API_KEY! The api key +# @env LLM_OUTPUT=/dev/stdout The output path The output path + +main() { + jq -n --arg query "$argc_query" \ + '{ + "query": $query +}' | + curl -fsSL -d @- \ + -X POST https://ollama.com/api/web_search \ + --header "Authorization: Bearer $OLLAMA_API_KEY" | jq -r '.results' >>"$LLM_OUTPUT" +} + +eval "$(argc --argc-eval "$0" "$@")"