exa-js 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# exa-js
|
|
2
|
+
|
|
3
|
+
Our official Javscript SDK. Uses `cross-fetch` under the hood.
|
|
4
|
+
|
|
5
|
+
https://www.npmjs.com/package/exa-js
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
```
|
|
9
|
+
npm install exa-js
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Initialization
|
|
13
|
+
```js
|
|
14
|
+
import Exa from "exa-node"
|
|
15
|
+
|
|
16
|
+
const exa = new Exa(process.env.EXA_API_KEY)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### `exa.search(query: string, options?: SearchOptions): Promise<SearchResponse>`
|
|
20
|
+
Performs a search on the Exa system with the given parameters.
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
const response = await exa.search('funny article about tech culture', {
|
|
24
|
+
numResults: 5,
|
|
25
|
+
includeDomains: ['nytimes.com', 'wsj.com'],
|
|
26
|
+
startPublishedDate: '2023-06-12'
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### `exa.findSimilar(url: string, options?: FindSimilarOptions): Promise<SearchResponse>`
|
|
31
|
+
Finds content similar to the specified URL.
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
const response = await exa.findSimilar('https://waitbutwhy.com/2014/05/fermi-paradox.html', {
|
|
35
|
+
numResults: 10
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `exa.getContents(ids: string[] | Result[]): Promise<GetContentsResponse>`
|
|
40
|
+
Retrieves the contents of the specified documents.
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
const response = await exa.getContents(['8U71IlQ5DUTdsZFherhhYA', 'X3wd0PbJmAvhu_DQjDKA7A']);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
# Contributing
|
|
47
|
+
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
|