Skip to content

Commit 703cedb

Browse files
committed
add web_fetch_exa.sh
1 parent 616d8d8 commit 703cedb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tools/web_fetch_exa.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# @describe Fetch contents of a URI using Exa API.
5+
# Use this when you need to get contents of a link, where you think is relevant info to be found.
6+
7+
# @option --url! The query to search for.
8+
9+
# @env EXA_API_KEY! The api key
10+
# @env LLM_OUTPUT=/dev/stdout The output path The output path
11+
12+
main() {
13+
curl -X POST 'https://api.exa.ai/contents' \
14+
-H "x-api-key: $EXA_API_KEY" \
15+
-H 'Content-Type: application/json' \
16+
-d '{
17+
"urls": ["'"$argc_url"'"],
18+
"text": true,
19+
"type": "keyword",
20+
"numResults": 1
21+
}' | \
22+
jq -r '.results[0].text' >> "$LLM_OUTPUT"
23+
}
24+
25+
eval "$(argc --argc-eval "$0" "$@")"

0 commit comments

Comments
 (0)