aboutsummaryrefslogtreecommitdiffstats
path: root/tools/search_arxiv.sh
blob: 1a7f2797a9c6e0b183cf1159b6787fabe49b4d2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash
set -e

# @describe Search arXiv for a query and return the top papers.

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

# @env ARXIV_MAX_RESULTS=3 The max results to return.
# @env LLM_OUTPUT=/dev/stdout The output path

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" >> "$LLM_OUTPUT"
}

eval "$(argc --argc-eval "$0" "$@")"