@pdfvector/client 0.1.3 → 0.2.1
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/CHANGELOG.md +19 -0
- package/README.md +7 -1
- package/dist/contract.cjs +219 -85
- package/dist/contract.d.cts +22 -1
- package/dist/contract.d.mts +22 -1
- package/dist/contract.mjs +219 -85
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +24 -1
- package/dist/index.d.mts +24 -1
- package/dist/index.mjs +5 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1538,6 +1538,8 @@ function inferSuggestion(code, message, data) {
|
|
|
1538
1538
|
}
|
|
1539
1539
|
if (code === "INTERNAL_SERVER_ERROR") return requestId ? `Retry the request. If it keeps failing, contact support with requestId ${requestId}.` : "Retry the request. If it keeps failing, contact support with the request details.";
|
|
1540
1540
|
if (hasHigherModelHint(message, data)) {
|
|
1541
|
+
const suggestedModel = readString(data, "suggestedModel");
|
|
1542
|
+
if (suggestedModel) return `Retry the request with model '${suggestedModel}'.`;
|
|
1541
1543
|
const requestedModel = readString(data, "requestedModel");
|
|
1542
1544
|
return requestedModel ? `Retry with a higher model than '${requestedModel}', or reduce the file size/pages before sending it again.` : "Retry with a higher model, or reduce the file size/pages before sending it again.";
|
|
1543
1545
|
}
|
|
@@ -1575,6 +1577,7 @@ var PDFVectorError = class extends Error {
|
|
|
1575
1577
|
retryable;
|
|
1576
1578
|
retryableWithHigherModel;
|
|
1577
1579
|
requestedModel;
|
|
1580
|
+
suggestedModel;
|
|
1578
1581
|
reasonCode;
|
|
1579
1582
|
supportMessage;
|
|
1580
1583
|
constructor(options) {
|
|
@@ -1593,6 +1596,7 @@ var PDFVectorError = class extends Error {
|
|
|
1593
1596
|
this.retryableWithHigherModel = hasHigherModelHint(this.message, this.data);
|
|
1594
1597
|
this.retryable = this.retryableWithHigherModel || isUpstreamFailure(this.data) || this.code === "TOO_MANY_REQUESTS" || this.code === "INTERNAL_SERVER_ERROR";
|
|
1595
1598
|
this.requestedModel = readString(this.data, "requestedModel");
|
|
1599
|
+
this.suggestedModel = readString(this.data, "suggestedModel");
|
|
1596
1600
|
this.reasonCode = readString(this.data, "code");
|
|
1597
1601
|
this.supportMessage = this.requestId ? `PDF Vector request ${this.requestId} failed with ${this.code}: ${this.message}` : `PDF Vector request failed with ${this.code}: ${this.message}`;
|
|
1598
1602
|
}
|
|
@@ -1613,6 +1617,7 @@ var PDFVectorError = class extends Error {
|
|
|
1613
1617
|
...this.documentId !== void 0 ? { documentId: this.documentId } : {},
|
|
1614
1618
|
...this.reasonCode !== void 0 ? { reasonCode: this.reasonCode } : {},
|
|
1615
1619
|
...this.requestedModel !== void 0 ? { requestedModel: this.requestedModel } : {},
|
|
1620
|
+
...this.suggestedModel !== void 0 ? { suggestedModel: this.suggestedModel } : {},
|
|
1616
1621
|
supportMessage: this.supportMessage,
|
|
1617
1622
|
data: this.data
|
|
1618
1623
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -2081,6 +2081,22 @@ declare const bankStatementParse: ContractProcedureBuilderWithInputOutput<z.ZodO
|
|
|
2081
2081
|
requestId: z.ZodNumber;
|
|
2082
2082
|
html: z.ZodOptional<z.ZodString>;
|
|
2083
2083
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
2084
|
+
declare const documentParse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
2085
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
2086
|
+
file: z.ZodOptional<z.ZodFile>;
|
|
2087
|
+
base64: z.ZodOptional<z.ZodString>;
|
|
2088
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2089
|
+
markdown: z.ZodString;
|
|
2090
|
+
pageCount: z.ZodNumber;
|
|
2091
|
+
model: z.ZodEnum<{
|
|
2092
|
+
max: "max";
|
|
2093
|
+
mini: "mini";
|
|
2094
|
+
nano: "nano";
|
|
2095
|
+
pro: "pro";
|
|
2096
|
+
}>;
|
|
2097
|
+
requestId: z.ZodNumber;
|
|
2098
|
+
html: z.ZodOptional<z.ZodString>;
|
|
2099
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
2084
2100
|
declare const generateSchema: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
2085
2101
|
instruction: z.ZodString;
|
|
2086
2102
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -2103,6 +2119,11 @@ declare const rateLimitStatus: ContractProcedureBuilderWithOutput<Schema$1<unkno
|
|
|
2103
2119
|
used: z.ZodNumber;
|
|
2104
2120
|
remaining: z.ZodNumber;
|
|
2105
2121
|
}, z.core.$strip>;
|
|
2122
|
+
documentParse: z.ZodObject<{
|
|
2123
|
+
limit: z.ZodNumber;
|
|
2124
|
+
used: z.ZodNumber;
|
|
2125
|
+
remaining: z.ZodNumber;
|
|
2126
|
+
}, z.core.$strip>;
|
|
2106
2127
|
generateSchema: z.ZodObject<{
|
|
2107
2128
|
limit: z.ZodNumber;
|
|
2108
2129
|
used: z.ZodNumber;
|
|
@@ -2115,7 +2136,7 @@ declare const rateLimitStatus: ContractProcedureBuilderWithOutput<Schema$1<unkno
|
|
|
2115
2136
|
}, z.core.$strip>;
|
|
2116
2137
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
2117
2138
|
declare namespace index_d_exports$3 {
|
|
2118
|
-
export { bankStatementParse, generateSchema, publicationPdfUrl, rateLimitStatus };
|
|
2139
|
+
export { bankStatementParse, documentParse, generateSchema, publicationPdfUrl, rateLimitStatus };
|
|
2119
2140
|
}
|
|
2120
2141
|
declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
2121
2142
|
url: z.ZodOptional<z.ZodURL>;
|
|
@@ -2474,6 +2495,7 @@ interface PDFVectorAgentError {
|
|
|
2474
2495
|
documentId?: string;
|
|
2475
2496
|
reasonCode?: string;
|
|
2476
2497
|
requestedModel?: string;
|
|
2498
|
+
suggestedModel?: string;
|
|
2477
2499
|
supportMessage: string;
|
|
2478
2500
|
data: Record<string, unknown>;
|
|
2479
2501
|
}
|
|
@@ -2491,6 +2513,7 @@ export declare class PDFVectorError extends Error {
|
|
|
2491
2513
|
readonly retryable: boolean;
|
|
2492
2514
|
readonly retryableWithHigherModel: boolean;
|
|
2493
2515
|
readonly requestedModel: string | undefined;
|
|
2516
|
+
readonly suggestedModel: string | undefined;
|
|
2494
2517
|
readonly reasonCode: string | undefined;
|
|
2495
2518
|
readonly supportMessage: string;
|
|
2496
2519
|
constructor(options: PDFVectorErrorOptions);
|
package/dist/index.d.mts
CHANGED
|
@@ -2081,6 +2081,22 @@ declare const bankStatementParse: ContractProcedureBuilderWithInputOutput<z.ZodO
|
|
|
2081
2081
|
requestId: z.ZodNumber;
|
|
2082
2082
|
html: z.ZodOptional<z.ZodString>;
|
|
2083
2083
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
2084
|
+
declare const documentParse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
2085
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
2086
|
+
file: z.ZodOptional<z.ZodFile>;
|
|
2087
|
+
base64: z.ZodOptional<z.ZodString>;
|
|
2088
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2089
|
+
markdown: z.ZodString;
|
|
2090
|
+
pageCount: z.ZodNumber;
|
|
2091
|
+
model: z.ZodEnum<{
|
|
2092
|
+
max: "max";
|
|
2093
|
+
mini: "mini";
|
|
2094
|
+
nano: "nano";
|
|
2095
|
+
pro: "pro";
|
|
2096
|
+
}>;
|
|
2097
|
+
requestId: z.ZodNumber;
|
|
2098
|
+
html: z.ZodOptional<z.ZodString>;
|
|
2099
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
2084
2100
|
declare const generateSchema: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
2085
2101
|
instruction: z.ZodString;
|
|
2086
2102
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -2103,6 +2119,11 @@ declare const rateLimitStatus: ContractProcedureBuilderWithOutput<Schema$1<unkno
|
|
|
2103
2119
|
used: z.ZodNumber;
|
|
2104
2120
|
remaining: z.ZodNumber;
|
|
2105
2121
|
}, z.core.$strip>;
|
|
2122
|
+
documentParse: z.ZodObject<{
|
|
2123
|
+
limit: z.ZodNumber;
|
|
2124
|
+
used: z.ZodNumber;
|
|
2125
|
+
remaining: z.ZodNumber;
|
|
2126
|
+
}, z.core.$strip>;
|
|
2106
2127
|
generateSchema: z.ZodObject<{
|
|
2107
2128
|
limit: z.ZodNumber;
|
|
2108
2129
|
used: z.ZodNumber;
|
|
@@ -2115,7 +2136,7 @@ declare const rateLimitStatus: ContractProcedureBuilderWithOutput<Schema$1<unkno
|
|
|
2115
2136
|
}, z.core.$strip>;
|
|
2116
2137
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
2117
2138
|
declare namespace index_d_exports$3 {
|
|
2118
|
-
export { bankStatementParse, generateSchema, publicationPdfUrl, rateLimitStatus };
|
|
2139
|
+
export { bankStatementParse, documentParse, generateSchema, publicationPdfUrl, rateLimitStatus };
|
|
2119
2140
|
}
|
|
2120
2141
|
declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
2121
2142
|
url: z.ZodOptional<z.ZodURL>;
|
|
@@ -2474,6 +2495,7 @@ interface PDFVectorAgentError {
|
|
|
2474
2495
|
documentId?: string;
|
|
2475
2496
|
reasonCode?: string;
|
|
2476
2497
|
requestedModel?: string;
|
|
2498
|
+
suggestedModel?: string;
|
|
2477
2499
|
supportMessage: string;
|
|
2478
2500
|
data: Record<string, unknown>;
|
|
2479
2501
|
}
|
|
@@ -2491,6 +2513,7 @@ export declare class PDFVectorError extends Error {
|
|
|
2491
2513
|
readonly retryable: boolean;
|
|
2492
2514
|
readonly retryableWithHigherModel: boolean;
|
|
2493
2515
|
readonly requestedModel: string | undefined;
|
|
2516
|
+
readonly suggestedModel: string | undefined;
|
|
2494
2517
|
readonly reasonCode: string | undefined;
|
|
2495
2518
|
readonly supportMessage: string;
|
|
2496
2519
|
constructor(options: PDFVectorErrorOptions);
|
package/dist/index.mjs
CHANGED
|
@@ -1537,6 +1537,8 @@ function inferSuggestion(code, message, data) {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
if (code === "INTERNAL_SERVER_ERROR") return requestId ? `Retry the request. If it keeps failing, contact support with requestId ${requestId}.` : "Retry the request. If it keeps failing, contact support with the request details.";
|
|
1539
1539
|
if (hasHigherModelHint(message, data)) {
|
|
1540
|
+
const suggestedModel = readString(data, "suggestedModel");
|
|
1541
|
+
if (suggestedModel) return `Retry the request with model '${suggestedModel}'.`;
|
|
1540
1542
|
const requestedModel = readString(data, "requestedModel");
|
|
1541
1543
|
return requestedModel ? `Retry with a higher model than '${requestedModel}', or reduce the file size/pages before sending it again.` : "Retry with a higher model, or reduce the file size/pages before sending it again.";
|
|
1542
1544
|
}
|
|
@@ -1574,6 +1576,7 @@ var PDFVectorError = class extends Error {
|
|
|
1574
1576
|
retryable;
|
|
1575
1577
|
retryableWithHigherModel;
|
|
1576
1578
|
requestedModel;
|
|
1579
|
+
suggestedModel;
|
|
1577
1580
|
reasonCode;
|
|
1578
1581
|
supportMessage;
|
|
1579
1582
|
constructor(options) {
|
|
@@ -1592,6 +1595,7 @@ var PDFVectorError = class extends Error {
|
|
|
1592
1595
|
this.retryableWithHigherModel = hasHigherModelHint(this.message, this.data);
|
|
1593
1596
|
this.retryable = this.retryableWithHigherModel || isUpstreamFailure(this.data) || this.code === "TOO_MANY_REQUESTS" || this.code === "INTERNAL_SERVER_ERROR";
|
|
1594
1597
|
this.requestedModel = readString(this.data, "requestedModel");
|
|
1598
|
+
this.suggestedModel = readString(this.data, "suggestedModel");
|
|
1595
1599
|
this.reasonCode = readString(this.data, "code");
|
|
1596
1600
|
this.supportMessage = this.requestId ? `PDF Vector request ${this.requestId} failed with ${this.code}: ${this.message}` : `PDF Vector request failed with ${this.code}: ${this.message}`;
|
|
1597
1601
|
}
|
|
@@ -1612,6 +1616,7 @@ var PDFVectorError = class extends Error {
|
|
|
1612
1616
|
...this.documentId !== void 0 ? { documentId: this.documentId } : {},
|
|
1613
1617
|
...this.reasonCode !== void 0 ? { reasonCode: this.reasonCode } : {},
|
|
1614
1618
|
...this.requestedModel !== void 0 ? { requestedModel: this.requestedModel } : {},
|
|
1619
|
+
...this.suggestedModel !== void 0 ? { suggestedModel: this.suggestedModel } : {},
|
|
1615
1620
|
supportMessage: this.supportMessage,
|
|
1616
1621
|
data: this.data
|
|
1617
1622
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfvector/client",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official TypeScript/JavaScript SDK for PDF Vector API",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/orchestero/pdfvector.git",
|
|
10
10
|
"directory": "packages/client"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://pdfvector.com",
|