File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -e
3+
4+ # @describe Perform a web search using Exa API to get up-to-date information or additional context.
5+ # Use this when you need current information or feel a search could provide a better answer.
6+ # 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.
8+
9+ # @option --query! The query to search for.
10+
11+ # @env EXA_API_KEY! The api key
12+ # @env LLM_OUTPUT=/dev/stdout The output path The output path
13+
14+ main () {
15+ curl -X POST ' https://api.exa.ai/search' \
16+ -H " x-api-key: $EXA_API_KEY " \
17+ -H ' Content-Type: application/json' \
18+ -d ' {
19+ "query": "' " $argc_query " ' ",
20+ "text": true,
21+ "type": "keyword",
22+ "numResults": 1
23+ }' | \
24+ jq -r ' .results[0] | (.text, .url)' >> " $LLM_OUTPUT "
25+ }
26+
27+ eval " $( argc --argc-eval " $0 " " $@ " ) "
You can’t perform that action at this time.
0 commit comments