-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
125 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# @describe Search arXiv for a query and return the top papers. | ||
|
||
# @env ARXIV_MAX_RESULTS=5 The max results to return. | ||
# @option --query! The query to search for. | ||
|
||
main() { | ||
encoded_query="$(jq -nr --arg q "$argc_query" '$q|@uri')" | ||
url="http://export.arxiv.org/api/query?search_query=all:$encoded_query&max_results=$ARXIV_MAX_RESULTS" | ||
curl -fsSL "$url" | ||
} | ||
|
||
eval "$(argc --argc-eval "$0" "$@")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# @describe Perform a web search using Bing Web Search 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 BING_API_KEY! The api key | ||
# @env BING_MAX_RESULTS=5 The max results to return. | ||
# @option --query! The query to search for. | ||
|
||
main() { | ||
encoded_query="$(jq -nr --arg q "$argc_query" '$q|@uri')" | ||
url="https://api.bing.microsoft.com/v7.0/search?q=$encoded_query&mkt=en-us&textdecorations=true&textformat=raw&count=$BING_MAX_RESULTS&offset=0" | ||
curl -fsSL "$url" \ | ||
-H "Ocp-Apim-Subscription-Key: $BING_API_KEY" | \ | ||
jq '[.webPages.value[] | {name: .name, url: .url, snippet: .snippet}]' | ||
} | ||
|
||
eval "$(argc --argc-eval "$0" "$@")" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# @describe Perform a web search using Brave Search 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 BRAVE_API_KEY! The api key | ||
# @env BRAVE_MAX_RESULTS=5 The max results to return. | ||
# @option --query! The query to search for. | ||
|
||
main() { | ||
encoded_query="$(jq -nr --arg q "$argc_query" '$q|@uri')" | ||
url="https://api.search.brave.com/res/v1/web/search?q=$encoded_query&count=$BRAVE_MAX_RESULTS" | ||
curl -fsSL "$url" \ | ||
-H "Accept: application/json" \ | ||
-H "X-Subscription-Token: $BRAVE_API_KEY" | \ | ||
jq '[.web.results[] | {title: .title, url: .url, description: .description}]' | ||
} | ||
|
||
eval "$(argc --argc-eval "$0" "$@")" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# @describe Perform a web search using Exa 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 EXA_API_KEY! The api key | ||
# @env EXA_MAX_RESULTS=5 The max results to return. | ||
# @option --query! The query to search for. | ||
|
||
main() { | ||
curl -fsSL -X POST https://api.exa.ai/search \ | ||
-H "content-type: application/json" \ | ||
-H "x-api-key: $EXA_API_KEY" \ | ||
-d ' | ||
{ | ||
"query": "'"$argc_query"'", | ||
"numResults": '"$EXA_MAX_RESULTS"', | ||
"type": "keyword", | ||
"contents": { | ||
"text": { | ||
"maxCharacters": 200 | ||
} | ||
} | ||
}' | \ | ||
jq '[.results[] | {title: .title, url: .url, text: .text}]' | ||
} | ||
|
||
eval "$(argc --argc-eval "$0" "$@")" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# @describe Perform a web search using SearXNG 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 SEARXNG_API_BASE! The api url | ||
# @env SEARXNG_MAX_RESULTS=5 The max results to return. | ||
# @option --query! The query to search for. | ||
|
||
main() { | ||
encoded_query="$(jq -nr --arg q "$argc_query" '$q|@uri')" | ||
url="$SEARXNG_API_BASE/search?q=$encoded_query&categories=general&language=en-US&format=json" | ||
curl -fsSL "$url" | \ | ||
jq '[.results[:'"$SEARXNG_MAX_RESULTS"'] | .[] | {url: .url, title: .title, content: .content}]' | ||
|
||
} | ||
|
||
eval "$(argc --argc-eval "$0" "$@")" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters