Skip to content

Commit 79cb61d

Browse files
committed
update exa tools
1 parent 18915ba commit 79cb61d

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

tools/web_fetch_exa.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22
set -e
33

44
# @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.
5+
# Use this when you need to get contents of a link, where you think relevant info is to be found.
66

77
# @option --url! The query to search for.
88

99
# @env EXA_API_KEY! The api key
1010
# @env LLM_OUTPUT=/dev/stdout The output path The output path
1111

1212
main() {
13-
curl -X POST 'https://api.exa.ai/contents' \
13+
curl -fsS -X POST 'https://api.exa.ai/contents' \
1414
-H "x-api-key: $EXA_API_KEY" \
1515
-H 'Content-Type: application/json' \
1616
-d '{
1717
"urls": ["'"$argc_url"'"],
18-
"text": true,
19-
"type": "keyword",
20-
"numResults": 1
18+
"text": true
2119
}' | \
2220
jq -r '.results[0].text' >> "$LLM_OUTPUT"
2321
}

tools/web_search_exa.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
# @describe Perform a web search using Exa API to get up-to-date information or additional context.
4+
# @describe Perform a web search using Exa API to get a list of links to fetch.
55
# Use this when you need current information or feel a search could provide a better answer.
66
# Construct the query out of keywords, not human sentences, sorted by relevance - just like a good Google query.
7-
# This returns text, then URL. Print that URL so that it's transparent where you got the info from.
7+
# This returns text, then URL for every result found. Judging by the title of the page, fetch relevant info.
88

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

1111
# @env EXA_API_KEY! The api key
1212
# @env LLM_OUTPUT=/dev/stdout The output path The output path
1313

1414
main() {
15-
curl -X POST 'https://api.exa.ai/search' \
15+
curl -fsS -X POST 'https://api.exa.ai/search' \
1616
-H "x-api-key: $EXA_API_KEY" \
1717
-H 'Content-Type: application/json' \
1818
-d '{
1919
"query": "'"$argc_query"'",
20-
"text": true,
2120
"type": "keyword",
22-
"numResults": 1
21+
"numResults": 20
2322
}' | \
24-
jq -r '.results[0] | (.text, .url)' >> "$LLM_OUTPUT"
23+
jq -r '.results[] | (.title, .url, "")' >> "$LLM_OUTPUT"
2524
}
2625

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

0 commit comments

Comments
 (0)