exa-js 1.5.13 → 1.7.0
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 +4 -15
- package/dist/index.d.mts +1871 -0
- package/dist/index.d.ts +1450 -2
- package/dist/index.js +797 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +771 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -26,9 +26,6 @@ const exa = new Exa(process.env.EXA_API_KEY)
|
|
|
26
26
|
// Basic search
|
|
27
27
|
const basicResults = await exa.search("This is a Exa query:");
|
|
28
28
|
|
|
29
|
-
// Autoprompted search
|
|
30
|
-
const autoPromptedResults = await exa.search("autopromptable query", { useAutoprompt: true });
|
|
31
|
-
|
|
32
29
|
// Search with date filters
|
|
33
30
|
const dateFilteredResults = await exa.search("This is a Exa query:", {
|
|
34
31
|
startPublishedDate: "2019-01-01",
|
|
@@ -43,13 +40,9 @@ const domainFilteredResults = await exa.search("This is a Exa query:", {
|
|
|
43
40
|
// Search and get text contents
|
|
44
41
|
const searchAndTextResults = await exa.searchAndContents("This is a Exa query:", { text: true });
|
|
45
42
|
|
|
46
|
-
// Search and get highlights
|
|
47
|
-
const searchAndHighlightsResults = await exa.searchAndContents("This is a Exa query:", { highlights: true });
|
|
48
|
-
|
|
49
43
|
// Search and get contents with contents options
|
|
50
44
|
const searchAndCustomContentsResults = await exa.searchAndContents("This is a Exa query:", {
|
|
51
|
-
text: {
|
|
52
|
-
highlights: { highlightsPerUrl: 2, numSentences: 1, query: "This is the highlight query:" }
|
|
45
|
+
text: { maxCharacters: 3000 }
|
|
53
46
|
});
|
|
54
47
|
|
|
55
48
|
// Find similar documents
|
|
@@ -59,18 +52,14 @@ const similarResults = await exa.findSimilar("https://example.com");
|
|
|
59
52
|
const similarExcludingSourceResults = await exa.findSimilar("https://example.com", { excludeSourceDomain: true });
|
|
60
53
|
|
|
61
54
|
// Find similar with contents
|
|
62
|
-
const similarWithContentsResults = await exa.findSimilarAndContents("https://example.com", { text: true
|
|
55
|
+
const similarWithContentsResults = await exa.findSimilarAndContents("https://example.com", { text: true });
|
|
63
56
|
|
|
64
57
|
// Get text contents
|
|
65
58
|
const textContentsResults = await exa.getContents(["urls"], { text: true });
|
|
66
59
|
|
|
67
|
-
// Get highlights
|
|
68
|
-
const highlightsContentsResults = await exa.getContents(["urls"], { highlights: true });
|
|
69
|
-
|
|
70
60
|
// Get contents with contents options
|
|
71
61
|
const customContentsResults = await exa.getContents(["urls"], {
|
|
72
|
-
text: { includeHtmlTags: true, maxCharacters:
|
|
73
|
-
highlights: { highlightsPerUrl: 2, numSentences: 1, query: "This is the highlight query:" }
|
|
62
|
+
text: { includeHtmlTags: true, maxCharacters: 3000 }
|
|
74
63
|
});
|
|
75
64
|
|
|
76
65
|
// Get an answer to a question
|
|
@@ -117,7 +106,7 @@ const response = await exa.findSimilar('https://waitbutwhy.com/2014/05/fermi-par
|
|
|
117
106
|
Retrieves the contents of the specified documents.
|
|
118
107
|
|
|
119
108
|
```javascript
|
|
120
|
-
const response = await exa.getContents(['
|
|
109
|
+
const response = await exa.getContents(['https://blog.samaltman.com/how-to-be-successful']);
|
|
121
110
|
```
|
|
122
111
|
|
|
123
112
|
### `exa.answer(query: string, options?: AnswerOptions): Promise<AnswerResponse>`
|