@gemina/sdk 0.2.1 → 0.3.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 +34 -2
- package/dist/index.cjs +596 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +730 -169
- package/dist/index.d.ts +730 -169
- package/dist/index.js +550 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,9 @@ const result = await client.processDocument(
|
|
|
64
64
|
- `meta.documentId` — the stored document's ID (use it with `client.documents`).
|
|
65
65
|
- `meta.correlationId` — the async processing correlation ID.
|
|
66
66
|
|
|
67
|
-
Extraction types (`
|
|
67
|
+
Extraction types (`UploadExtractionTypeEnum`) — note `filetag` is not one of
|
|
68
|
+
them: FileTag has its own endpoints (`client.fileTag`), and the upload endpoints
|
|
69
|
+
reject it.
|
|
68
70
|
|
|
69
71
|
| Type | What it extracts |
|
|
70
72
|
|------|------------------|
|
|
@@ -74,7 +76,6 @@ Extraction types (`ExtractionTypeModel`):
|
|
|
74
76
|
| `document_details_hebrew` | Hebrew document details |
|
|
75
77
|
| `document_line_items_hebrew` | Hebrew document line items |
|
|
76
78
|
| `custom_template` | Fields defined by your custom template (pass `templateId`) |
|
|
77
|
-
| `filetag` | File classification metadata (FileTag) |
|
|
78
79
|
|
|
79
80
|
## Search & aggregate your documents
|
|
80
81
|
|
|
@@ -136,6 +137,37 @@ const { fields } = await client.retrieval.retrievalFields();
|
|
|
136
137
|
// -> [{ documentType: "invoice", field: "vendor_name", count: 42 }, ...]
|
|
137
138
|
```
|
|
138
139
|
|
|
140
|
+
## What did an extraction cost?
|
|
141
|
+
|
|
142
|
+
Credits are charged *after* the result is delivered, so cost is a separate
|
|
143
|
+
lookup rather than a field on the extraction response. Ask for one extraction,
|
|
144
|
+
or up to 100 at a time:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
const { data } = await client.documents.getExtractionCost({
|
|
148
|
+
documentExtractionId: extractionId,
|
|
149
|
+
});
|
|
150
|
+
console.log(data.state, data.creditsConsumed); // "settled" "2.5"
|
|
151
|
+
|
|
152
|
+
const bulk = await client.documents.getExtractionCosts({
|
|
153
|
+
ids: [extractionId, otherExtractionId],
|
|
154
|
+
});
|
|
155
|
+
for (const cost of bulk.data.costs) {
|
|
156
|
+
console.log(cost.extractionId, cost.state, cost.creditsConsumed);
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`state` tells you whether the number is final:
|
|
161
|
+
|
|
162
|
+
- `settled` — the charge is on record; this is the authoritative number.
|
|
163
|
+
- `pending` — billing has not run yet. Retry.
|
|
164
|
+
- `not_charged` — billing finished without a charge. This never resolves, so
|
|
165
|
+
don't poll it.
|
|
166
|
+
|
|
167
|
+
Enterprise accounts are billed in contract dollars: `creditsConsumed` is null
|
|
168
|
+
and `costCents` carries the amount. The bulk call silently omits ids you don't
|
|
169
|
+
own, so key the response by `extractionId` rather than assuming input order.
|
|
170
|
+
|
|
139
171
|
## Chat with your documents
|
|
140
172
|
|
|
141
173
|
Ask free-form questions over everything you've processed. Answers come back with a confidence signal and citations to the source documents:
|