@gemina/sdk 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -238,6 +238,51 @@ const results = await browserClient.retrieval.retrievalQuery({
|
|
|
238
238
|
|
|
239
239
|
For a drop-in chat UI, see `@gemina/elements` on npm.
|
|
240
240
|
|
|
241
|
+
## Human verification in the browser
|
|
242
|
+
|
|
243
|
+
`@gemina/elements` also ships `<GeminaVerification>`: a drop-in review step that puts the document next to every extracted field, lets a person correct what's wrong, and sends the corrections back to Gemina for accuracy scoring.
|
|
244
|
+
|
|
245
|
+
Mint the token **scoped to the extraction being reviewed** — an unscoped token that reaches a browser can read every extraction in your account:
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
// Server-side (holds the API key)
|
|
249
|
+
const session = await client.sessions.mintRetrievalToken({
|
|
250
|
+
sessionTokenInDTO: {
|
|
251
|
+
extractionIds: [extractionId], // up to 10; pins the token to these
|
|
252
|
+
ttlSeconds: 900,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
An empty list is rejected rather than quietly minting a tenant-wide token. Your endpoint must check that the requesting end-user is allowed to see those extractions: Gemina enforces the claim, you decide who gets it.
|
|
258
|
+
|
|
259
|
+
Upload with `evaluation: true` to give the reviewer per-field confidence scores and the "hide everything already scored high" filter.
|
|
260
|
+
|
|
261
|
+
**Reading the result back** is one call, and it's the source of truth — the widget's browser callback is best-effort, this isn't:
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
const view = await client.documents.getDocumentExtraction({
|
|
265
|
+
documentExtractionId: extractionId,
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
view.meta.validated; // has a human verified this yet?
|
|
269
|
+
view.values; // what the model extracted
|
|
270
|
+
view.verifiedValues; // same shape, corrections merged in — null until verified
|
|
271
|
+
view.verifiedDiff; // what the reviewer changed
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
`verifiedValues` is deliberately the same shape as `values`, so moving your pipeline from raw to human-verified data is a one-key change. Each `verifiedDiff` entry is `field`, `pointer`, `original`, `verified` and a `status` of `corrected`, `added` or `removed`; the pointer resolves against both payloads, so you can show before and after. All three fields also appear on the results-poll and list surfaces, so a batch job can sweep for `meta.validated` without fetching extractions one by one.
|
|
275
|
+
|
|
276
|
+
Verification is **one-shot** per extraction — a second submission is rejected with 409. To submit a review from your own UI instead of the widget:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
const summary = await client.documents.validateDocumentExtraction({
|
|
280
|
+
targetDocumentExtractionId: extractionId,
|
|
281
|
+
extractionValidationInDTO: { data: correctedValues },
|
|
282
|
+
});
|
|
283
|
+
// summary.data -> per-field comparison against what was extracted
|
|
284
|
+
```
|
|
285
|
+
|
|
241
286
|
## Going deeper
|
|
242
287
|
|
|
243
288
|
**Full API surface.** The convenience layer sits on top of a complete generated client. Every API group is available on the client as a lazy accessor: `documents`, `retrieval`, `chat`, `templates`, `files`, `fileTag`, `sessions`, `subscriptions`, `billing`. For example, list your stored documents:
|
package/dist/index.cjs
CHANGED
|
@@ -11232,7 +11232,7 @@ async function asProcessingErrorIfFailedResult(error) {
|
|
|
11232
11232
|
}
|
|
11233
11233
|
|
|
11234
11234
|
// src/version.ts
|
|
11235
|
-
var VERSION = "0.
|
|
11235
|
+
var VERSION = "0.14.0";
|
|
11236
11236
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11237
11237
|
0 && (module.exports = {
|
|
11238
11238
|
AggregateMetaDTOFromJSON,
|