@perplexity-ai/perplexity_ai 0.43.0 → 0.43.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/CHANGELOG.md +7 -0
- package/README.md +57 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.43.1](https://github.com/perplexityai/perplexity-node/compare/v0.43.0...v0.43.1) (2026-11-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Documentation
|
|
7
|
+
|
|
8
|
+
* **embeddings:** recommend pplx-embed-v2 models and add v2 tests ([#126](https://github.com/perplexityai/perplexity-node/issues/126)) ([d45ed77](https://github.com/perplexityai/perplexity-node/commit/d45ed7775667f9ef76d75598c2b17669f9784b91))
|
|
9
|
+
|
|
3
10
|
## [0.43.0](https://github.com/perplexityai/perplexity-node/compare/v0.42.0...v0.43.0) (2026-11-18)
|
|
4
11
|
|
|
5
12
|
|
package/README.md
CHANGED
|
@@ -57,6 +57,63 @@ const streamChunk = await client.chat.completions.create({
|
|
|
57
57
|
console.log(streamChunk.choices[0].message.content);
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Embeddings
|
|
61
|
+
|
|
62
|
+
Use the pplx-embed-v2 models. Start with `pplx-embed-v2-context-0.6b` for higher
|
|
63
|
+
throughput and lower latency, and choose `pplx-embed-v2-context-9b` for retrieval
|
|
64
|
+
quality. Their 1024-dimension outputs share one embedding space, so you can index
|
|
65
|
+
with one model and query with the other. The `pplx-embed-v1-*` and
|
|
66
|
+
`pplx-embed-context-v1-*` models still work but will be phased out during 2027.
|
|
67
|
+
See the [Embeddings guide](https://docs.perplexity.ai/docs/embeddings/contextualized-embeddings)
|
|
68
|
+
for parameters and limits.
|
|
69
|
+
|
|
70
|
+
v2 models require `input_type`: `'query'` for the text a user types to search, and
|
|
71
|
+
`'document'` for everything you index, including short titles or summaries. The
|
|
72
|
+
shape of `input` sets the shape of the response:
|
|
73
|
+
|
|
74
|
+
| `input` | `input_type` | Response |
|
|
75
|
+
| -------------------------------------------- | ------------ | ----------------------------------------------------------- |
|
|
76
|
+
| String or array of strings | `'query'` | One embedding per query, `data[i].embedding` |
|
|
77
|
+
| String or array of strings | `'document'` | One embedding per document, `data[i].embedding` |
|
|
78
|
+
| Array of chunk arrays, one per document | `'document'` | One embedding per chunk, `data[i].data[j].embedding` |
|
|
79
|
+
| Array of image objects | `'document'` | One embedding per image, `data[i].embedding` |
|
|
80
|
+
| Array of image objects with `num_chunks` > 1 | `'document'` | One embedding per image region, `data[i].data[j].embedding` |
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import Perplexity from '@perplexity-ai/perplexity_ai';
|
|
84
|
+
|
|
85
|
+
const client = new Perplexity();
|
|
86
|
+
|
|
87
|
+
const query = await client.embeddings.create({
|
|
88
|
+
input: ['What drives scientific breakthroughs?'],
|
|
89
|
+
input_type: 'query',
|
|
90
|
+
model: 'pplx-embed-v2-context-0.6b',
|
|
91
|
+
});
|
|
92
|
+
console.log(query.data?.[0]?.embedding);
|
|
93
|
+
|
|
94
|
+
// Each chunk is embedded in the context of its whole document. Send
|
|
95
|
+
// non-overlapping chunks in source order.
|
|
96
|
+
const documents = await client.embeddings.create({
|
|
97
|
+
input: [
|
|
98
|
+
['Curiosity sparks questions.', 'They drive breakthroughs.'],
|
|
99
|
+
['The Curiosity rover explores Mars.'],
|
|
100
|
+
],
|
|
101
|
+
input_type: 'document',
|
|
102
|
+
model: 'pplx-embed-v2-context-0.6b',
|
|
103
|
+
});
|
|
104
|
+
for (const document of documents.data ?? []) {
|
|
105
|
+
for (const chunk of document.data ?? []) {
|
|
106
|
+
console.log(document.index, chunk.index, chunk.embedding);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Images are base64 data URIs such as
|
|
112
|
+
`{ type: 'image', image: 'data:image/png;base64,...' }`. A request holds either
|
|
113
|
+
text or images, not both. Embeddings are base64-encoded signed int8 values by
|
|
114
|
+
default; decode one with `new Int8Array(Buffer.from(embedding, 'base64'))` and
|
|
115
|
+
compare with cosine similarity.
|
|
116
|
+
|
|
60
117
|
### Advanced Search Features
|
|
61
118
|
|
|
62
119
|
#### Multi-Query Search
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.43.
|
|
1
|
+
export declare const VERSION = "0.43.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.43.
|
|
1
|
+
export const VERSION = '0.43.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.43.
|
|
1
|
+
export const VERSION = '0.43.1'; // x-release-please-version
|