feat(ai-perplexity): add Perplexity Search integration#2232
Draft
jliounis wants to merge 1 commit into
Draft
Conversation
🦋 Changeset detectedLatest commit: 23407a8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Author
|
@IMax153 — opened this against |
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 new
@effect/ai-perplexitypackage providing Effect v4 bindings for the Perplexity Search API.Re-opens #6204 against the v4 repo per @IMax153's request.
What's added
PerplexityClient— HTTP client wrapper that handles authentication and error mapping (platformHttpClienterrors →AiError).PerplexitySearch— service with asearch(options)method that returns a typedSearchResponse(results: { title, url, snippet, date? }[]).max_results,max_tokens_per_page,search_domain_filter,search_recency_filter,search_after_date_filter,search_before_date_filter.search_domain_filterdoes not mix allow- and deny-list entries (the API does not accept that), failing fast with anAiErrorwhose reason isInvalidRequestError.PERPLEXITY_API_KEY, falling back toPPLX_API_KEY, viaConfig.redacted. A custom URL can be supplied viaPERPLEXITY_API_URLor programmatically.PerplexityConfigservice andwithClientTransformhelper, mirroring the pattern used by@effect/ai-anthropic.Tests
Unit tests in
packages/ai/perplexity/test/PerplexitySearch.test.ts, using a mockedHttpClientso no network calls are made: request body construction, allowlist/denylist handling (including mixed-mode rejection), success decoding, non-2xx error mapping, malformed JSON handling, and header/URL/method assertions.Run with:
All three pass locally.
Docs
packages/ai/perplexity/README.mddocuments installation, authentication, basic usage, available options, and the domain-filter caveat.References
Original v3 PR (closed per feature freeze): Effect-TS/effect#6204