Repository navigation
feat(embeddings): add Perplexity embeddings provider - #10142
Draft
andrewmadson-pplx wants to merge 1 commit into
Draft
andrewmadson-pplx wants to merge 1 commit into
andrewmadson-pplx wants to merge 1 commit into
Conversation
|
@andrewmadson-pplx is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
1 of 10 tasks
This branch has not been deployed
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 Perplexity as an Embeddings block provider, backed by the Perplexity Embeddings API (
POST https://api.perplexity.ai/v1/embeddings) withpplx-embed-v1-0.6b(up to 1024 dimensions) andpplx-embed-v1-4b(up to 2560). It follows the Mistral provider: adapter, catalog entries, key resolution (BYOK,PERPLEXITY_API_KEY), theembeddings_perplexitytool, block routing, the internal tool registry, pricing, generated metadata and docs.The API returns vectors as
base64_int8and has no float encoding (encoding_format: "float"returns 400), so the adapter decodes the signed int8 values and L2-normalizes them. Cosine similarity is unchanged and the block returns unit vectors like the other providers. Knowledge-base indexing stays off (kbEligible: false), the same as Mistral and Cohere.I work at Perplexity, which operates this API.
Product update (if relevant)
Embeddings block users can pick Perplexity and choose
pplx-embed-v1-4borpplx-embed-v1-0.6b, with Matryoshka dimension reduction down to 128. Docs: integrations/embeddings.Type of Change
Testing
cd apps/sim && bun run test -- lib/embeddings tools/embeddings blocks/blocks/embeddings.test.ts lib/internal/embeddings lib/internal/tool-operations(with the CI env varsNEXT_PUBLIC_APP_URL,DATABASE_URL,ENCRYPTION_KEY): Test Files 19 passed (19), Tests 134 passed (134). The new adapter tests cover the request body (base64_int8, reduceddimensions), the request headers, and int8 decoding to unit vectors in input order. The tool projection test now includes the new tool.bun run --cwd apps/sim type-checkandbun run type-check:scripts:esm: exit 0, no diagnostics.bun run lint:check: 27 of 27 tasks pass (one existing warning in a file this PR does not touch).bun run check:tool-metadata,check:docs,check:integration-catalog,check:deployment-config,check:mapper-operation,check:canvas-sentencesandcheck:explicit-any, plusapps/sim/scripts/check-block-registry.ts: all exit 0.buildRequestandparse: both models at native width (1024 and 2560), andpplx-embed-v1-4bat 1024 and 128, each returned one unit vector per input at the requested width, with related inputs scoring higher than unrelated ones.To try it: run
bun run dev, add an Embeddings block, set Provider to Perplexity and enter a Perplexity API key. Withpplx-embed-v1-4band default dimensions, embed two or three strings and check you get one 2560-length vector per input, in input order. Set Dimensions to 1024 and check the vectors are 1024 long. Pickpplx-embed-v1-0.6band check the Dimensions dropdown tops out at 1024.Checklist
Screenshots/Videos