File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33[ ![ PyPI - Version] ( https://img.shields.io/pypi/v/perplexity-haystack.svg )] ( https://pypi.org/project/perplexity-haystack )
44[ ![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/perplexity-haystack.svg )] ( https://pypi.org/project/perplexity-haystack )
55
6+ - [ Integration page] ( https://haystack.deepset.ai/integrations/perplexity )
67- [ Changelog] ( https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/perplexity/CHANGELOG.md )
78
89---
910
10- ## Installation
11-
12- ``` bash
13- pip install perplexity-haystack
14- ```
15-
16- ## Usage
17-
18- Set your ` PERPLEXITY_API_KEY ` and use ` PerplexityWebSearch ` in a pipeline:
19-
20- ``` python
21- from haystack import Pipeline
22- from haystack.utils import Secret
23- from haystack_integrations.components.websearch.perplexity import PerplexityWebSearch
24-
25- websearch = PerplexityWebSearch(
26- api_key = Secret.from_env_var(" PERPLEXITY_API_KEY" ),
27- top_k = 5 ,
28- )
29- result = websearch.run(query = " What is Haystack by deepset?" )
30- documents = result[" documents" ]
31- links = result[" links" ]
32- ```
33-
34- See the [ Perplexity Search API reference] ( https://docs.perplexity.ai/api-reference/search-post ) for the full list of supported parameters.
35-
36- Use ` PerplexityChatGenerator ` for chat generation through the Perplexity Agent API:
37-
38- ``` python
39- from haystack.dataclasses import ChatMessage
40- from haystack_integrations.components.generators.perplexity import PerplexityChatGenerator
41-
42- chat_generator = PerplexityChatGenerator(model = " openai/gpt-5.4" )
43- response = chat_generator.run([ChatMessage.from_user(" What is Haystack by deepset?" )])
44- print (response[" replies" ][0 ].text)
45- ```
46-
47- See the [ Perplexity Agent API quickstart] ( https://docs.perplexity.ai/docs/agent-api/quickstart ) for supported parameters.
48-
4911## Contributing
5012
5113Refer to the general [ Contribution Guidelines] ( https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md ) .
You can’t perform that action at this time.
0 commit comments