spec-sync(v2): parse: add per-word atomic_grounding confidence score - #144
spec-sync(v2): parse: add per-word atomic_grounding confidence score#144yzld2002 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 carryconfidence. Since the assertion below is conditional, this contract test can pass without ever observing the new field. Requestdpt-3-fastand require at least one non-Noneconfidence 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_groundingcan 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`.
|
|
Automated V2 spec-sync PR (
client.v2).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
confidencescore to word-granularityatomic_groundingsegments in parse responses, alongside a spec-only addition of the (unimplemented)/v1/extract/build-schemaroutes.Changes:
V2ParseNodeGroundinggains an optionalconfidencefield ([0, 1]), populated only on word-granularityatomic_groundingentries fromdpt-3-fast, andNoneelsewhere.atomic_groundingdocumentation updated to clarify granularity varies by model: one entry per line fordpt-3-pro, one per word fordpt-3-fast.atomic_groundingcan be[]fortable_cellelements on word-granularity models when word offsets can't be reliably located.docs/v2-testing.mdupdated to describe the newconfidencefield and per-model granularity behavior./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.