Skip to content

spec-sync(v2): parse: add per-word atomic_grounding confidence score - #144

Open
yzld2002 wants to merge 2 commits into
mainfrom
spec-sync/v2
Open

spec-sync(v2): parse: add per-word atomic_grounding confidence score#144
yzld2002 wants to merge 2 commits into
mainfrom
spec-sync/v2

Conversation

@yzld2002

@yzld2002 yzld2002 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Automated V2 spec-sync PR (client.v2).

  • Commit 1 (mechanical): normalized V2 spec snapshot + regenerated reference models.
  • Commit 2 (AI, only if the spec diff needs SDK changes): client.v2 resources/methods/tests/docs wired from the diff, added after this PR opened. Workflow-only drift is excluded and an AI no-op is skipped, so some drifts produce a mechanical-only PR with no second commit.

Gates (surface-lock, V2 contract tests, lint/test/typecheck) must pass. When present, the AI commit is a draft a human finishes (the V2 ergonomic layer — unified Job, dual-host, schema coercion — is not in the spec). Human review required before merge.

What changed

AI-generated from the PR diff — verify against the actual changes.

This PR adds a confidence score to word-granularity atomic_grounding segments in parse responses, alongside a spec-only addition of the (unimplemented) /v1/extract/build-schema routes.

Changes:

  • V2ParseNodeGrounding gains an optional confidence field ([0, 1]), populated only on word-granularity atomic_grounding entries from dpt-3-fast, and None elsewhere.
  • atomic_grounding documentation updated to clarify granularity varies by model: one entry per line for dpt-3-pro, one per word for dpt-3-fast.
  • Documented new edge case where atomic_grounding can be [] for table_cell elements on word-granularity models when word offsets can't be reliably located.
  • docs/v2-testing.md updated to describe the new confidence field and per-model granularity behavior.
  • Spec snapshot also adds /v1/extract/build-schema (and its jobs sub-routes), but this surface is not wired into the client and is not part of this PR's SDK changes.

Copilot AI balanced review requested due to automatic review settings August 11, 2026 21:15
@yzld2002
yzld2002 deployed to spec-sync-contract August 11, 2026 21:15 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the automated V2 specification snapshot and regenerated reference models to track upstream drift.

Changes:

  • Refreshes the V2 OpenAPI snapshot.
  • Regenerates reference models, including updated grounding metadata and endpoint schemas.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
specs/v2-aide.json Updates the mirrored V2 specification snapshot.
specs/_generated/v2_models.py Regenerates Python reference models from the snapshot.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings August 11, 2026 21:20
@yzld2002
yzld2002 deployed to spec-sync-contract August 11, 2026 21:20 — with GitHub Actions Active
@yzld2002 yzld2002 changed the title spec-sync: track V2 spec drift spec-sync(v2): parse: add per-word atomic_grounding confidence score Aug 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Suppressed comments (2)

tests/contract/test_v2_smoke.py:113

  • This call uses the documented default DPT-3 Pro model (README.md:88), whose line-granularity segments do not carry confidence. Since the assertion below is conditional, this contract test can pass without ever observing the new field. Request dpt-3-fast and require at least one non-None confidence value.
    resp = staging_client.v2.parse(document=pdf, options={"atomic_grounding": True})
    assert isinstance(resp, V2ParseResponse)
    assert resp.structure is not None and resp.structure.children

docs/v2-testing.md:47

  • The PR description says this guide documents the new empty-list edge case, but this paragraph only explains when the field is omitted. Document that table_cell.atomic_grounding can legitimately be [] when word offsets cannot be located in escaped rendered table text, so consumers do not treat that response as malformed.
  - Leaf elements additionally carry `atomic_grounding` -- a list of
    `V2ParseNodeGrounding` segments at whichever granularity the model reads at:
    one entry per visual line for `dpt-3-pro`, one per word (each with its
    `confidence`) for `dpt-3-fast`. Omitted when `options.atomic_grounding` is
    `false`.

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