feat: add Perplexity Search API example (Python + TypeScript)#94
Open
jliounis wants to merge 1 commit into
Open
feat: add Perplexity Search API example (Python + TypeScript)#94jliounis wants to merge 1 commit into
jliounis wants to merge 1 commit into
Conversation
Adds two examples in examples/perplexity-search-{js,python} demonstrating
how to call the Perplexity Search API and analyze results inside an E2B
sandbox.
- Auth via PERPLEXITY_API_KEY (PPLX_API_KEY also accepted)
- Helper supports query, max_results, search_domain_filter,
search_recency_filter
- Sandbox loads results.json and prints top domains + snippets
- Wired into tests/examples.test.ts; PERPLEXITY_API_KEY added to
tests/utils.ts env passthrough
- README updated with links to both examples
Author
|
All checks are green and the PR has been clean since it opened. Could a maintainer take a look when you have a moment? Both the TS and Python examples follow the existing cookbook structure and exercise the Search API end-to-end via the E2B sandbox. Happy to address any feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Perplexity Search API recipe to the cookbook, following the same pattern as the existing Firecrawl and Exa examples (third-party search/data API + E2B sandbox for analysis).
Two parallel examples are included:
examples/perplexity-search-js/— TypeScript / Node, mirrors themcp-groq-exa-jsstyle.examples/perplexity-search-python/— Poetry project, mirrors thehello-world-python/langchain-pythonstyle.Both call
POST https://api.perplexity.ai/searchdirectly (no extra SDK), then write the JSON results into an E2B sandbox and run a small Python snippet that prints the top domains and result snippets.Search options exposed
query(required)max_results(configurable, not hardcoded — defaults to the API default of 10 unless set)search_domain_filter(allowlist or-domain.comdenylist; not mixed)search_recency_filter(hour|day|week|month|year)Auth
PERPLEXITY_API_KEY, falls back toPPLX_API_KEY.Wiring
tests/examples.test.ts: registeredperplexity-search-js(npm) andperplexity-search-python(poetry).tests/utils.ts: addedPERPLEXITY_API_KEYto the env passthrough used by the integration harness.How to run
TypeScript:
Python:
cd examples/perplexity-search-python cp .env.template .env poetry install poetry run startValidation
npx tsc --noEmit).tests/examples.test.tsintegration harness.Docs