- Python
- TypeScript
This embedding function relies on the
perplexityai python package, which you can install with pip install perplexityai.Semantic Search with Chroma
Here’s a complete example of using Perplexity embeddings with Chroma for semantic search:- Python
- TypeScript
Available Models
Perplexity offers two embedding models:| Model | Dimensions | Context Window | Price |
|---|---|---|---|
pplx-embed-v1-0.6b | 1024 | 32K tokens | $0.004/1M tokens |
pplx-embed-v1-4b | 2560 | 32K tokens | $0.03/1M tokens |
Matryoshka Dimensions
Both models support Matryoshka Representation Learning, allowing you to reduce embedding dimensions while maintaining quality. This is useful for reducing storage costs and improving search speed.- Python
- TypeScript
pplx-embed-v1-0.6b: 128 to 1024pplx-embed-v1-4b: 128 to 2560