File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change 22set -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
1212main () {
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}
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -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
1414main () {
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
2726eval " $( argc --argc-eval " $0 " " $@ " ) "
You can’t perform that action at this time.
0 commit comments