@perplexity-ai/perplexity_ai 0.26.3 → 0.26.5
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/CHANGELOG.md +13 -0
- package/README.md +21 -36
- package/package.json +1 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.26.5 (2026-03-24)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.26.4...v0.26.5](https://github.com/perplexityai/perplexity-node/compare/v0.26.4...v0.26.5)
|
|
6
|
+
|
|
7
|
+
### Chores
|
|
8
|
+
|
|
9
|
+
* **ci:** skip lint on metadata-only changes ([75bb43c](https://github.com/perplexityai/perplexity-node/commit/75bb43c9794991dcd3b6e497e84a12ef217341ad))
|
|
10
|
+
* **internal:** update gitignore ([b0c4a8b](https://github.com/perplexityai/perplexity-node/commit/b0c4a8bc9de2af3ff8c2c073828c9b8bd1898733))
|
|
11
|
+
|
|
12
|
+
## 0.26.4 (2026-03-22)
|
|
13
|
+
|
|
14
|
+
Full Changelog: [v0.26.3...v0.26.4](https://github.com/perplexityai/perplexity-node/compare/v0.26.3...v0.26.4)
|
|
15
|
+
|
|
3
16
|
## 0.26.3 (2026-03-16)
|
|
4
17
|
|
|
5
18
|
Full Changelog: [v0.26.2...v0.26.3](https://github.com/perplexityai/perplexity-node/compare/v0.26.2...v0.26.3)
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ const client = new Perplexity({
|
|
|
31
31
|
|
|
32
32
|
const search = await client.search.create({
|
|
33
33
|
query: "latest AI developments 2024",
|
|
34
|
-
|
|
34
|
+
max_results: 5
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
for (const result of search.results) {
|
|
@@ -71,7 +71,7 @@ const search = await client.search.create({
|
|
|
71
71
|
"solar power innovations",
|
|
72
72
|
"wind energy developments"
|
|
73
73
|
],
|
|
74
|
-
|
|
74
|
+
max_results: 10
|
|
75
75
|
});
|
|
76
76
|
```
|
|
77
77
|
|
|
@@ -82,13 +82,13 @@ Limit search results to specific trusted domains:
|
|
|
82
82
|
```js
|
|
83
83
|
const search = await client.search.create({
|
|
84
84
|
query: "climate change research",
|
|
85
|
-
|
|
85
|
+
search_domain_filter: [
|
|
86
86
|
"science.org",
|
|
87
87
|
"pnas.org",
|
|
88
88
|
"cell.com",
|
|
89
89
|
"nature.com"
|
|
90
90
|
],
|
|
91
|
-
|
|
91
|
+
max_results: 10
|
|
92
92
|
});
|
|
93
93
|
```
|
|
94
94
|
|
|
@@ -100,14 +100,14 @@ Filter results by recency or specific date ranges:
|
|
|
100
100
|
// Get results from the past week
|
|
101
101
|
const recentSearch = await client.search.create({
|
|
102
102
|
query: "latest AI developments",
|
|
103
|
-
|
|
103
|
+
search_recency_filter: "week"
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
// Search within a specific date range
|
|
107
107
|
const dateRangeSearch = await client.search.create({
|
|
108
108
|
query: "AI developments",
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
search_after_date_filter: "01/01/2024",
|
|
110
|
+
search_before_date_filter: "12/31/2024"
|
|
111
111
|
});
|
|
112
112
|
```
|
|
113
113
|
|
|
@@ -118,24 +118,8 @@ Search academic sources for research purposes:
|
|
|
118
118
|
```js
|
|
119
119
|
const academicSearch = await client.search.create({
|
|
120
120
|
query: "machine learning algorithms",
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
#### Location-Based Search
|
|
127
|
-
|
|
128
|
-
Get geographically relevant results:
|
|
129
|
-
|
|
130
|
-
```js
|
|
131
|
-
const localSearch = await client.search.create({
|
|
132
|
-
query: "local restaurants",
|
|
133
|
-
userLocationFilter: {
|
|
134
|
-
latitude: 37.7749,
|
|
135
|
-
longitude: -122.4194,
|
|
136
|
-
radius: 10 // km
|
|
137
|
-
},
|
|
138
|
-
maxResults: 10
|
|
121
|
+
search_mode: "academic",
|
|
122
|
+
max_results: 10
|
|
139
123
|
});
|
|
140
124
|
```
|
|
141
125
|
|
|
@@ -175,16 +159,17 @@ const client = new Perplexity({
|
|
|
175
159
|
// Search API types
|
|
176
160
|
const searchParams: Perplexity.Search.SearchCreateParams = {
|
|
177
161
|
query: "artificial intelligence trends",
|
|
178
|
-
|
|
179
|
-
|
|
162
|
+
max_results: 5,
|
|
163
|
+
search_mode: "web"
|
|
180
164
|
};
|
|
181
165
|
const searchResponse: Perplexity.Search.SearchCreateResponse = await client.search.create(searchParams);
|
|
182
166
|
|
|
183
|
-
//
|
|
184
|
-
const
|
|
185
|
-
|
|
167
|
+
// Responses API types
|
|
168
|
+
const responseParams: Perplexity.ResponseCreateParams = {
|
|
169
|
+
input: "What is the capital of France?",
|
|
170
|
+
model: "sonar",
|
|
186
171
|
};
|
|
187
|
-
const
|
|
172
|
+
const response: Perplexity.ResponseCreateResponse = await client.responses.create(responseParams);
|
|
188
173
|
|
|
189
174
|
// Chat Completions types
|
|
190
175
|
const chatParams: Perplexity.Chat.CompletionCreateParams = {
|
|
@@ -205,7 +190,7 @@ a subclass of `APIError` will be thrown:
|
|
|
205
190
|
```ts
|
|
206
191
|
// Search API error handling
|
|
207
192
|
const search = await client.search
|
|
208
|
-
.create({ query: "AI developments",
|
|
193
|
+
.create({ query: "AI developments", max_results: 5 })
|
|
209
194
|
.catch(async (err) => {
|
|
210
195
|
if (err instanceof Perplexity.APIError) {
|
|
211
196
|
console.log(err.status); // 400
|
|
@@ -261,7 +246,7 @@ const client = new Perplexity({
|
|
|
261
246
|
});
|
|
262
247
|
|
|
263
248
|
// Or, configure per-request:
|
|
264
|
-
await client.search.create({ query: "AI developments",
|
|
249
|
+
await client.search.create({ query: "AI developments", max_results: 5 }, {
|
|
265
250
|
maxRetries: 5,
|
|
266
251
|
});
|
|
267
252
|
|
|
@@ -281,7 +266,7 @@ const client = new Perplexity({
|
|
|
281
266
|
});
|
|
282
267
|
|
|
283
268
|
// Override per-request:
|
|
284
|
-
await client.search.create({ query: "AI developments",
|
|
269
|
+
await client.search.create({ query: "AI developments", max_results: 5 }, {
|
|
285
270
|
timeout: 5 * 1000,
|
|
286
271
|
});
|
|
287
272
|
|
|
@@ -309,13 +294,13 @@ const client = new Perplexity();
|
|
|
309
294
|
|
|
310
295
|
// With search API
|
|
311
296
|
const searchResponse = await client.search
|
|
312
|
-
.create({ query: "AI developments",
|
|
297
|
+
.create({ query: "AI developments", max_results: 5 })
|
|
313
298
|
.asResponse();
|
|
314
299
|
console.log(searchResponse.headers.get('X-My-Header'));
|
|
315
300
|
console.log(searchResponse.statusText); // access the underlying Response object
|
|
316
301
|
|
|
317
302
|
const { data: search, response: rawSearchResponse } = await client.search
|
|
318
|
-
.create({ query: "AI developments",
|
|
303
|
+
.create({ query: "AI developments", max_results: 5 })
|
|
319
304
|
.withResponse();
|
|
320
305
|
console.log(rawSearchResponse.headers.get('X-My-Header'));
|
|
321
306
|
console.log(search.results.length);
|
package/package.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.26.
|
|
1
|
+
export const VERSION = '0.26.5'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.26.
|
|
1
|
+
export declare const VERSION = "0.26.5";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.26.
|
|
1
|
+
export declare const VERSION = "0.26.5";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.26.
|
|
1
|
+
export const VERSION = '0.26.5'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|