@anyformat/sdk 1.12.0 → 1.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/dist/index.cjs +46 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +46 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1765,6 +1765,60 @@ type FloatField = {
|
|
|
1765
1765
|
*/
|
|
1766
1766
|
source?: 'extraction' | 'smart_lookup' | 'lookup_if_missing';
|
|
1767
1767
|
};
|
|
1768
|
+
/**
|
|
1769
|
+
* GroundTruthSetRequest
|
|
1770
|
+
*
|
|
1771
|
+
* Body for `PUT /v3/document-packets/{document_packet_id}/ground-truth/`.
|
|
1772
|
+
*/
|
|
1773
|
+
type GroundTruthSetRequest = {
|
|
1774
|
+
/**
|
|
1775
|
+
* Ground Truth
|
|
1776
|
+
*
|
|
1777
|
+
* The complete expected document. Keys are the workflow schema's field identifiers: advertise `persistent_id` (the API also accepts `sanitized_name`). A scalar field maps to `string | null`; a table or object field maps to an array of row objects. Every field must be present; a list field may be `[]`.
|
|
1778
|
+
*/
|
|
1779
|
+
ground_truth: {
|
|
1780
|
+
[key: string]: unknown;
|
|
1781
|
+
};
|
|
1782
|
+
/**
|
|
1783
|
+
* Node Id
|
|
1784
|
+
*
|
|
1785
|
+
* The extract node's `id` in the workflow graph, as `GET /v3/workflows/{workflow_id}/` returns it. Required only when the version has more than one extract node.
|
|
1786
|
+
*/
|
|
1787
|
+
node_id?: string | null;
|
|
1788
|
+
/**
|
|
1789
|
+
* Version Id
|
|
1790
|
+
*
|
|
1791
|
+
* A `version_id` from `GET /v3/workflows/{workflow_id}/versions/`. Omit it for the workflow's current version, the one an eval grades by default.
|
|
1792
|
+
*/
|
|
1793
|
+
version_id?: string | null;
|
|
1794
|
+
};
|
|
1795
|
+
/**
|
|
1796
|
+
* GroundTruthV3
|
|
1797
|
+
*
|
|
1798
|
+
* A document packet's stored ground truth and the `(version, node)` it belongs to.
|
|
1799
|
+
*/
|
|
1800
|
+
type GroundTruthV3 = {
|
|
1801
|
+
/**
|
|
1802
|
+
* Ground Truth
|
|
1803
|
+
*
|
|
1804
|
+
* The expected document, keyed by the workflow's field `persistent_id`s. A scalar field maps to `string | null`; a table or object field maps to an array of row objects keyed the same way. `null` until ground truth is first set for this version and node.
|
|
1805
|
+
*/
|
|
1806
|
+
ground_truth: {
|
|
1807
|
+
[key: string]: unknown;
|
|
1808
|
+
} | null;
|
|
1809
|
+
/**
|
|
1810
|
+
* Node Id
|
|
1811
|
+
*
|
|
1812
|
+
* The extract node's `id` in the workflow graph.
|
|
1813
|
+
*/
|
|
1814
|
+
node_id: string;
|
|
1815
|
+
/**
|
|
1816
|
+
* Version Id
|
|
1817
|
+
*
|
|
1818
|
+
* The workflow version the ground truth belongs to.
|
|
1819
|
+
*/
|
|
1820
|
+
version_id: string;
|
|
1821
|
+
};
|
|
1768
1822
|
/**
|
|
1769
1823
|
* Hyperlink
|
|
1770
1824
|
*
|
|
@@ -3436,6 +3490,23 @@ declare class Anyformat {
|
|
|
3436
3490
|
getEvalAccuracy(workflowId: string, evalId: string): Promise<AccuracyV3>;
|
|
3437
3491
|
/** One eval document's extracted values beside its ground truth. The id is the dataset copy's. */
|
|
3438
3492
|
getEvalDocumentPacketFields(workflowId: string, evalId: string, documentPacketId: string): Promise<EvalDocumentPacketFieldsV3>;
|
|
3493
|
+
/**
|
|
3494
|
+
* A dataset document packet's ground truth, keyed by field `persistent_id`,
|
|
3495
|
+
* or `null` until it is first set. Omit `version` for the workflow's current
|
|
3496
|
+
* version; `nodeId` is needed only when the version has more than one extract node.
|
|
3497
|
+
*/
|
|
3498
|
+
getGroundTruth(documentPacketId: string, opts?: {
|
|
3499
|
+
version?: string;
|
|
3500
|
+
nodeId?: string;
|
|
3501
|
+
}): Promise<GroundTruthV3>;
|
|
3502
|
+
/**
|
|
3503
|
+
* Create or replace a dataset document packet's complete ground truth and
|
|
3504
|
+
* return it as stored. A production packet throws with `NOT_IN_DATASET`.
|
|
3505
|
+
*/
|
|
3506
|
+
setGroundTruth(documentPacketId: string, groundTruth: Record<string, unknown>, opts?: {
|
|
3507
|
+
versionId?: string;
|
|
3508
|
+
nodeId?: string;
|
|
3509
|
+
}): Promise<GroundTruthV3>;
|
|
3439
3510
|
}
|
|
3440
3511
|
|
|
3441
3512
|
declare class AnyformatError extends Error {
|
|
@@ -3515,4 +3586,4 @@ declare class ExtractionCancelledError extends RunFailedError {
|
|
|
3515
3586
|
declare class WorkflowBuilderError extends AnyformatError {
|
|
3516
3587
|
}
|
|
3517
3588
|
|
|
3518
|
-
export { APIError, type AccuracyCoverageV3, type AccuracyV3, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, type DatasetTagAccuracyV3, type DatasetTagFilter, type DatasetTagV3, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketAccuracyV3, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type EvalDetailV3, type EvalDocumentPacketFieldsV3, type EvalLaunchedV3, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FieldAccuracyV3, type FieldValuesV3, type FloatField, ForbiddenError, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitPartition, type SplitResult, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3, type WorkflowVersionSummaryV3 };
|
|
3589
|
+
export { APIError, type AccuracyCoverageV3, type AccuracyV3, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, type DatasetTagAccuracyV3, type DatasetTagFilter, type DatasetTagV3, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketAccuracyV3, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type EvalDetailV3, type EvalDocumentPacketFieldsV3, type EvalLaunchedV3, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FieldAccuracyV3, type FieldValuesV3, type FloatField, ForbiddenError, type GroundTruthSetRequest, type GroundTruthV3, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitPartition, type SplitResult, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3, type WorkflowVersionSummaryV3 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1765,6 +1765,60 @@ type FloatField = {
|
|
|
1765
1765
|
*/
|
|
1766
1766
|
source?: 'extraction' | 'smart_lookup' | 'lookup_if_missing';
|
|
1767
1767
|
};
|
|
1768
|
+
/**
|
|
1769
|
+
* GroundTruthSetRequest
|
|
1770
|
+
*
|
|
1771
|
+
* Body for `PUT /v3/document-packets/{document_packet_id}/ground-truth/`.
|
|
1772
|
+
*/
|
|
1773
|
+
type GroundTruthSetRequest = {
|
|
1774
|
+
/**
|
|
1775
|
+
* Ground Truth
|
|
1776
|
+
*
|
|
1777
|
+
* The complete expected document. Keys are the workflow schema's field identifiers: advertise `persistent_id` (the API also accepts `sanitized_name`). A scalar field maps to `string | null`; a table or object field maps to an array of row objects. Every field must be present; a list field may be `[]`.
|
|
1778
|
+
*/
|
|
1779
|
+
ground_truth: {
|
|
1780
|
+
[key: string]: unknown;
|
|
1781
|
+
};
|
|
1782
|
+
/**
|
|
1783
|
+
* Node Id
|
|
1784
|
+
*
|
|
1785
|
+
* The extract node's `id` in the workflow graph, as `GET /v3/workflows/{workflow_id}/` returns it. Required only when the version has more than one extract node.
|
|
1786
|
+
*/
|
|
1787
|
+
node_id?: string | null;
|
|
1788
|
+
/**
|
|
1789
|
+
* Version Id
|
|
1790
|
+
*
|
|
1791
|
+
* A `version_id` from `GET /v3/workflows/{workflow_id}/versions/`. Omit it for the workflow's current version, the one an eval grades by default.
|
|
1792
|
+
*/
|
|
1793
|
+
version_id?: string | null;
|
|
1794
|
+
};
|
|
1795
|
+
/**
|
|
1796
|
+
* GroundTruthV3
|
|
1797
|
+
*
|
|
1798
|
+
* A document packet's stored ground truth and the `(version, node)` it belongs to.
|
|
1799
|
+
*/
|
|
1800
|
+
type GroundTruthV3 = {
|
|
1801
|
+
/**
|
|
1802
|
+
* Ground Truth
|
|
1803
|
+
*
|
|
1804
|
+
* The expected document, keyed by the workflow's field `persistent_id`s. A scalar field maps to `string | null`; a table or object field maps to an array of row objects keyed the same way. `null` until ground truth is first set for this version and node.
|
|
1805
|
+
*/
|
|
1806
|
+
ground_truth: {
|
|
1807
|
+
[key: string]: unknown;
|
|
1808
|
+
} | null;
|
|
1809
|
+
/**
|
|
1810
|
+
* Node Id
|
|
1811
|
+
*
|
|
1812
|
+
* The extract node's `id` in the workflow graph.
|
|
1813
|
+
*/
|
|
1814
|
+
node_id: string;
|
|
1815
|
+
/**
|
|
1816
|
+
* Version Id
|
|
1817
|
+
*
|
|
1818
|
+
* The workflow version the ground truth belongs to.
|
|
1819
|
+
*/
|
|
1820
|
+
version_id: string;
|
|
1821
|
+
};
|
|
1768
1822
|
/**
|
|
1769
1823
|
* Hyperlink
|
|
1770
1824
|
*
|
|
@@ -3436,6 +3490,23 @@ declare class Anyformat {
|
|
|
3436
3490
|
getEvalAccuracy(workflowId: string, evalId: string): Promise<AccuracyV3>;
|
|
3437
3491
|
/** One eval document's extracted values beside its ground truth. The id is the dataset copy's. */
|
|
3438
3492
|
getEvalDocumentPacketFields(workflowId: string, evalId: string, documentPacketId: string): Promise<EvalDocumentPacketFieldsV3>;
|
|
3493
|
+
/**
|
|
3494
|
+
* A dataset document packet's ground truth, keyed by field `persistent_id`,
|
|
3495
|
+
* or `null` until it is first set. Omit `version` for the workflow's current
|
|
3496
|
+
* version; `nodeId` is needed only when the version has more than one extract node.
|
|
3497
|
+
*/
|
|
3498
|
+
getGroundTruth(documentPacketId: string, opts?: {
|
|
3499
|
+
version?: string;
|
|
3500
|
+
nodeId?: string;
|
|
3501
|
+
}): Promise<GroundTruthV3>;
|
|
3502
|
+
/**
|
|
3503
|
+
* Create or replace a dataset document packet's complete ground truth and
|
|
3504
|
+
* return it as stored. A production packet throws with `NOT_IN_DATASET`.
|
|
3505
|
+
*/
|
|
3506
|
+
setGroundTruth(documentPacketId: string, groundTruth: Record<string, unknown>, opts?: {
|
|
3507
|
+
versionId?: string;
|
|
3508
|
+
nodeId?: string;
|
|
3509
|
+
}): Promise<GroundTruthV3>;
|
|
3439
3510
|
}
|
|
3440
3511
|
|
|
3441
3512
|
declare class AnyformatError extends Error {
|
|
@@ -3515,4 +3586,4 @@ declare class ExtractionCancelledError extends RunFailedError {
|
|
|
3515
3586
|
declare class WorkflowBuilderError extends AnyformatError {
|
|
3516
3587
|
}
|
|
3517
3588
|
|
|
3518
|
-
export { APIError, type AccuracyCoverageV3, type AccuracyV3, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, type DatasetTagAccuracyV3, type DatasetTagFilter, type DatasetTagV3, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketAccuracyV3, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type EvalDetailV3, type EvalDocumentPacketFieldsV3, type EvalLaunchedV3, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FieldAccuracyV3, type FieldValuesV3, type FloatField, ForbiddenError, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitPartition, type SplitResult, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3, type WorkflowVersionSummaryV3 };
|
|
3589
|
+
export { APIError, type AccuracyCoverageV3, type AccuracyV3, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, type DatasetTagAccuracyV3, type DatasetTagFilter, type DatasetTagV3, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketAccuracyV3, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type EvalDetailV3, type EvalDocumentPacketFieldsV3, type EvalLaunchedV3, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FieldAccuracyV3, type FieldValuesV3, type FloatField, ForbiddenError, type GroundTruthSetRequest, type GroundTruthV3, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitPartition, type SplitResult, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3, type WorkflowVersionSummaryV3 };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@anyformat/sdk",
|
|
4
|
-
version: "1.
|
|
4
|
+
version: "1.14.0",
|
|
5
5
|
description: "TypeScript SDK for the AnyFormat API",
|
|
6
6
|
license: "MIT",
|
|
7
7
|
author: "Anyformat <info@anyformat.ai>",
|
|
@@ -1069,6 +1069,20 @@ var v3GetDocumentPacket = (options) => (options.client ?? client).get({
|
|
|
1069
1069
|
url: "/v3/document-packets/{document_packet_id}/",
|
|
1070
1070
|
...options
|
|
1071
1071
|
});
|
|
1072
|
+
var v3GetGroundTruth = (options) => (options.client ?? client).get({
|
|
1073
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1074
|
+
url: "/v3/document-packets/{document_packet_id}/ground-truth/",
|
|
1075
|
+
...options
|
|
1076
|
+
});
|
|
1077
|
+
var v3SetGroundTruth = (options) => (options.client ?? client).put({
|
|
1078
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1079
|
+
url: "/v3/document-packets/{document_packet_id}/ground-truth/",
|
|
1080
|
+
...options,
|
|
1081
|
+
headers: {
|
|
1082
|
+
"Content-Type": "application/json",
|
|
1083
|
+
...options.headers
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1072
1086
|
var v3RunDocumentPacket = (options) => (options.client ?? client).post({
|
|
1073
1087
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1074
1088
|
url: "/v3/document-packets/{document_packet_id}/run/",
|
|
@@ -1916,6 +1930,37 @@ var Anyformat = class {
|
|
|
1916
1930
|
if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
|
|
1917
1931
|
return res.data;
|
|
1918
1932
|
}
|
|
1933
|
+
/**
|
|
1934
|
+
* A dataset document packet's ground truth, keyed by field `persistent_id`,
|
|
1935
|
+
* or `null` until it is first set. Omit `version` for the workflow's current
|
|
1936
|
+
* version; `nodeId` is needed only when the version has more than one extract node.
|
|
1937
|
+
*/
|
|
1938
|
+
async getGroundTruth(documentPacketId, opts = {}) {
|
|
1939
|
+
const res = await v3GetGroundTruth({
|
|
1940
|
+
client: this._client,
|
|
1941
|
+
path: { document_packet_id: documentPacketId },
|
|
1942
|
+
query: { version: opts.version, node_id: opts.nodeId }
|
|
1943
|
+
});
|
|
1944
|
+
if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
|
|
1945
|
+
return res.data;
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Create or replace a dataset document packet's complete ground truth and
|
|
1949
|
+
* return it as stored. A production packet throws with `NOT_IN_DATASET`.
|
|
1950
|
+
*/
|
|
1951
|
+
async setGroundTruth(documentPacketId, groundTruth, opts = {}) {
|
|
1952
|
+
const res = await v3SetGroundTruth({
|
|
1953
|
+
client: this._client,
|
|
1954
|
+
path: { document_packet_id: documentPacketId },
|
|
1955
|
+
body: {
|
|
1956
|
+
ground_truth: groundTruth,
|
|
1957
|
+
...opts.versionId ? { version_id: opts.versionId } : {},
|
|
1958
|
+
...opts.nodeId ? { node_id: opts.nodeId } : {}
|
|
1959
|
+
}
|
|
1960
|
+
});
|
|
1961
|
+
if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
|
|
1962
|
+
return res.data;
|
|
1963
|
+
}
|
|
1919
1964
|
};
|
|
1920
1965
|
|
|
1921
1966
|
// src/schema.ts
|