Skip to content

docs(embeddings): recommend pplx-embed-v2 models and add v2 tests - #155

Merged
gleb-reshetnev merged 3 commits into
perplexityai:mainfrom
bwang-pplx:embeddings-v2-context
Nov 19, 2026
Merged

gleb-reshetnev merged 3 commits into
perplexityai:mainfrom
bwang-pplx:embeddings-v2-context

Conversation

@bwang-pplx

@bwang-pplx bwang-pplx commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

client.embeddings.create already accepts pplx-embed-v2-context-9b and pplx-embed-v2-context-0.6b (synced in v0.47.0), but nothing in the package tells a user or a coding agent to use them. This PR makes v2 the documented default without changing v1 behavior.

  • README: new Embeddings section that recommends the v2 models, follows the published Embeddings guide: start with pplx-embed-v2-context-0.6b, choose pplx-embed-v2-context-9b for retrieval quality, v1 phases out during 2027. It covers input_type, an input to response shape table (queries, whole documents, chunked documents, images, num_chunks regions), and int8 decoding.
  • types/embedding_create_params.py: this is the params reference that api.md links, but it still listed only v1. It now lists the v2 models first, with docstrings that match the guide: the 0.6b/9b recommendation, input_type, num_chunks regions, the input shapes and their response shapes, v2 dimensions, and request limits. The change only adds fields and literals.
  • tests/test_embeddings.py (new, MockTransport): v1 0.6b/4b request bodies and responses, v2 queries, v2 whole documents, v2 chunked documents, v2 images with and without num_chunks, async v2, client side validation of bad model/input_type/num_chunks, and contextualized_embeddings v1.
  • e2e/live/test_embeddings.py: live v2 query and chunked document tests next to the existing v1 test.

Backward compatibility

  • No generated or resource code changes. v1 request bodies are asserted byte for byte.
  • The v1 and contextualized v1 tests in tests/test_embeddings.py also pass when run against v0.46.1, the last release before v2 was added.

Docstrings on embeddings.create

The generated client has no docstrings: the SDK codegen in ppl-ai/agi (tools/codegen/openapi_sdk) drops OpenAPI descriptions and only emits deprecation notes. Docstrings on client.embeddings.create itself need a codegen change there, which this PR does not include.

Testing

  • pytest tests (579 passed, 300 skipped) and ruff check/ruff format --check on the changed files. Bazel was not available in my environment, so CI will run bazel test //... and gazelle.
  • Live tests were not run (no PPLX_API_TOKEN).

Created with Perplexity

bwang-pplx and others added 2 commits November 19, 2026 11:11
Document pplx-embed-v2-context-9b and pplx-embed-v2-context-0.6b as the
default choice for new integrations, with input_type and chunked document
usage. Update the legacy embedding_create_params TypedDict, which api.md
links as the params reference, with the v2 models, input_type, num_chunks,
and chunked or image input shapes.

Add mock transport tests for v1 and v2 requests and responses, and live
tests for v2 queries and chunked documents. The v1 tests also pass against
v0.46.1, so v1 request bodies and response fields are unchanged.

Co-authored-by: Perplexity <noreply@perplexity.ai>
Recommend pplx-embed-v2-context-0.6b as the starting model and 9b for
retrieval quality, note the shared 1024-dimension space and the 2027 v1
phase-out, and document whole-document, chunked, and image input shapes,
num_chunks regions, and request limits. Add tests for v2 whole documents
and single-region images.

Co-authored-by: Perplexity <noreply@perplexity.ai>
@bwang-pplx
bwang-pplx marked this pull request as ready for review November 19, 2026 15:58
Embed a generated PNG as one image and as image regions with num_chunks.

Co-authored-by: Perplexity <noreply@perplexity.ai>
@gleb-reshetnev
gleb-reshetnev merged commit 74b5288 into perplexityai:main Nov 19, 2026
3 checks passed
@pplx-oss pplx-oss mentioned this pull request Nov 19, 2026
gleb-reshetnev pushed a commit that referenced this pull request Nov 19, 2026
Automated Release PR
---


##
[0.48.1](v0.48.0...v0.48.1)
(2026-11-19)


### Documentation

* **embeddings:** recommend pplx-embed-v2 models and add v2 tests
([#155](#155))
([74b5288](74b5288))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants