blob: ccb14cf987c372e352a0f1c9b290eeaba6881483 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/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}]' \
>> "$LLM_OUTPUT"
}
eval "$(argc --argc-eval "$0" "$@")"
|