Skip to content

feat(classify)!: classify() takes the types to choose among as types and answers each document's or page's type - #726

Merged
rejojer merged 1 commit into
mainfrom
feat/classify-types
Nov 29, 2026
Merged

rejojer merged 1 commit into
mainfrom
feat/classify-types

Conversation

@rejojer

@rejojer rejojer commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

classify() now takes the types to choose among as types and answers type, where 0.8.0 and 0.8.1 said classes and class. Code written against those two releases breaks; the change ships in 0.8.2.

from pageindex import PageClassifyClient

client = PageClassifyClient()
job = client.classify("invoice.pdf", {"invoice": "A bill asking for payment", "receipt": None})
job["type"]  # was job["class"]

job = client.classify("packet.pdf", ["invoice", "receipt"], granularity="page")
[(p["page"], p["type"]) for p in job["pages"]]  # was p["class"]

Users call these document types, not classes, and Python cannot write d.class or declare a model field named class. Page Classify was a day old and had almost no users, so it is renamed now.

Changes

  • classify(document, types, *, ...): the second parameter is types (was classes). It takes the same shapes: {name: description}, a list of names, one name, or a list of {"name", "description"}.
  • A completed job's type (granularity "document") and each pages[] entry's type (granularity "page") replace class. None still means none of the types fits.
  • CloudAPI.create_classify() sends {"types": ...}, and the docstrings follow.

Release

The server side is VectifyAI/pageindex-compute#1014: it takes configuration.types and answers type, and a request still sending classes gets a 422 that names it. Merge and release this only once #1014 is on Prod. Before then, types gets a 422; after it, 0.8.0 and 0.8.1 get one.

Verification

  • The Classify tests in tests/test_client.py are renamed: the configuration sent carries types, and results read type.
  • The suite locally, with no API key set: 1285 passed, 7 skipped. Two litellm-version tests are left out, because they fail on main too with the litellm installed here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T20:11:13.579196Z 78f68ec New commits
🔒 Security Review ✅ Completed 2026-11-29T20:12:15.499781Z 78f68ec New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…` and answers each document's or page's `type`

BREAKING CHANGE: classify(document, classes, ...) is classify(document, types, ...), and a completed job's 'class' (and each page's) is 'type'. The API takes "types" and answers "type" from the same release of the server on, so 0.8.0 and 0.8.1 calls get a 422 once it is deployed.

Users name these document types, not classes, and Python cannot write d.class or a model field named class. Page Classify was one day old with almost no users, so it is renamed now.
@rejojer
rejojer force-pushed the feat/classify-types branch from 7f6b0dd to 78f68ec Compare November 29, 2026 20:10
@rejojer rejojer changed the title feat(classify)!: classify() takes the types to choose among as types and answers each document's or page's type, as Page Split names them feat(classify)!: classify() takes the types to choose among as types and answers each document's or page's type Nov 29, 2026
@rejojer
rejojer merged commit 46bc7fb into main Nov 29, 2026
10 checks passed
rejojer added a commit that referenced this pull request Nov 29, 2026
…n place of classes and class (#727)

pyproject.toml carries the version the next tag publishes (#706): 0.8.2, for classify(document, types) and its 'type' (#726). Tagging v0.8.2 on this commit publishes it to PyPI.
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.

1 participant