@pdfvector/client 0.2.0 → 0.2.2

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pdfvector/client
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`5c69426`](https://github.com/orchestero/pdfvector/commit/5c694265ac44a4321a867ec626defbf0b91f7472)]:
8
+ - @pdfvector/instance-client@0.3.0
9
+
10
+ ## 0.2.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [#725](https://github.com/orchestero/pdfvector/pull/725) [`4e9bd5f`](https://github.com/orchestero/pdfvector/commit/4e9bd5f264452ee6f733ebf1966e86b1ea94b254) Thanks [@orchestero](https://github.com/orchestero)! - Package metadata: repository moved to orchestero/pdfvector
15
+ - Updated dependencies [[`4e9bd5f`](https://github.com/orchestero/pdfvector/commit/4e9bd5f264452ee6f733ebf1966e86b1ea94b254)]:
16
+ - @pdfvector/instance-client@0.2.1
17
+
3
18
  ## 0.2.0
4
19
 
5
20
  ### Minor Changes
package/dist/contract.cjs CHANGED
@@ -2205,11 +2205,22 @@ const paperGraph = oc.input(zod.z.object({
2205
2205
  return op;
2206
2206
  }
2207
2207
  });
2208
+ // ../util/lib/contract/instance/bare-file-name.ts
2209
+ const bareFileName = /^[^/?#]+\.(pdf|docx?|xlsx?|pptx?|csv|tsv|txt|md|rtf|odt|ods|odp|epub|png|jpe?g|tiff?|bmp|heic|heif|html?|xml|bib|zip)$/i;
2210
+ // ../util/lib/contract/instance/with-default-url-scheme.ts
2211
+ const schemeLessHost = /^[a-z\d-]+(\.[a-z\d-]+)*\.[a-z]{2,63}(:\d+)?([/?#]|$)/i;
2212
+ function withDefaultUrlScheme(value) {
2213
+ if (value.startsWith("//")) return `https:${value}`;
2214
+ return schemeLessHost.test(value) && !bareFileName.test(value) ? `https://${value}` : value;
2215
+ }
2208
2216
  // ../util/lib/contract/instance/fetchable-url-schema.ts
2209
- const fetchableUrlSchema = zod.z.url({
2210
- protocol: /^https?$/,
2211
- error: "URL must use http or https"
2212
- });
2217
+ function createFetchableUrlSchema(error) {
2218
+ return zod.z.string().trim().transform(withDefaultUrlScheme).pipe(zod.z.url({
2219
+ protocol: /^https?$/,
2220
+ error: (issue) => error(issue.input)
2221
+ }));
2222
+ }
2223
+ const fetchableUrlSchema = createFetchableUrlSchema(() => "URL must use http or https");
2213
2224
  // ../util/lib/contract/instance/page-markdown-schema.ts
2214
2225
  const pageMarkdownSchema = zod.z.object({
2215
2226
  pageNumber: zod.z.number().int().min(1).describe("1-based page number in the source document"),
@@ -2328,7 +2339,7 @@ const callbackSchema = zod.z.object({
2328
2339
  }).optional().describe("Optional webhook callback for async processing. When provided, the server returns 202 immediately and POSTs the full response payload to the callback URL when processing completes. On error, the callback receives a POST with X-Pdfvector-Callback-Failed: true header and error details in the body. Useful for long-running operations that may exceed client timeout limits.");
2329
2340
  const parseInputSchema$4 = zod.z.object({
2330
2341
  id: zod.z.string({ message: "id must be a string" }).trim().min(1, "id must be a non-empty string").optional().describe("Publication identifier to resolve and parse. Supports DOI, PubMed ID, ArXiv ID, Semantic Scholar ID, ERIC ID, Europe PMC ID, OpenAlex ID."),
2331
- url: fetchableUrlSchema.optional().describe("Publication URL to resolve and parse. Supports known provider URLs such as DOI, ArXiv, PubMed, Semantic Scholar, ERIC, Europe PMC, OpenAlex, Springer, Nature, bioRxiv, and medRxiv."),
2342
+ url: fetchableUrlSchema.optional().describe("Publication URL to resolve and parse. Supports known provider URLs such as DOI, ArXiv, PubMed, Semantic Scholar, ERIC, Europe PMC, OpenAlex, Springer, Nature, bioRxiv, and medRxiv. A URL without a scheme is fetched over https."),
2332
2343
  model: zod.z.enum(["auto", ...pdfvectorModelSchema.options]).optional().default("auto").describe(documentParseModelDescription),
2333
2344
  includePages: zod.z.boolean().optional().default(false).describe("Set to true to include page-separated markdown in the pages array. Existing markdown output is still returned as the full paper text."),
2334
2345
  callback: callbackSchema
@@ -2481,7 +2492,7 @@ const search = oc.input(zod.z.object({
2481
2492
  })).output(zod.z.object({
2482
2493
  estimatedTotalResults: zod.z.number(),
2483
2494
  results: zod.z.array(publicationSchema$1),
2484
- errors: zod.z.array(providerErrorSchema$1).nullish().describe("Providers that failed for this request (for example rate limited or unavailable). When present, `results` only contain papers from the providers that succeeded, so treat the response as partial; it is billed like any successful search. If every provider fails, the request fails with HTTP 503 (`SERVICE_UNAVAILABLE`, `data.code` `ALL_PROVIDERS_FAILED`, per-provider `data.errors`) and is not charged."),
2495
+ errors: zod.z.array(providerErrorSchema$1).nullish().describe("Providers that failed for this request (for example rate limited or unavailable). When present, `results` only contain papers from the providers that succeeded, so treat the response as partial; it is billed like any successful search. If every requested provider fails and they include `europe-pmc` but not `pubmed`, the search falls back to `pubmed` with the time left: `results` then come from PubMed (each result's `provider` says so) and each failed provider's entry here has `details.fallbackProvider` `pubmed`; it is billed like any successful search. If every provider fails (including that fallback, whose entry then has `details.fallback` `true`), the request fails with HTTP 503 (`SERVICE_UNAVAILABLE`, `data.code` `ALL_PROVIDERS_FAILED`, per-provider `data.errors`) and is not charged."),
2485
2496
  requestId: zod.z.number().int()
2486
2497
  })).route({
2487
2498
  summary: "Search academic papers",
@@ -3070,6 +3081,20 @@ const validateCredential = oc.route({
3070
3081
  }).input(inputSchema$4).output(outputSchema$5);
3071
3082
  // ../util/lib/contract/instance/router/authenticate/index.ts
3072
3083
  var authenticate_exports = /* @__PURE__ */ __exportAll({ validateCredential: () => validateCredential });
3084
+ // ../util/lib/contract/instance/local-document-url-hint.ts
3085
+ const localPath = /^(file:|[a-z]:[\\/]|\\\\|\/|~[\\/]|\.\.?[\\/])/i;
3086
+ const sendFileInstead = "Send the document itself instead with the file (multipart upload) or base64 field; in n8n, set Input Type to Binary Data.";
3087
+ function localDocumentUrlHint(input) {
3088
+ if (localPath.test(input) || bareFileName.test(input)) return `This looks like a file on your computer, which PDF Vector cannot read. ${sendFileInstead}`;
3089
+ if (/^blob:/i.test(input)) return `blob: URLs only exist inside your browser, so PDF Vector cannot fetch them. ${sendFileInstead}`;
3090
+ if (/[\r\n]/.test(input) || input.length > 200 && /\s/.test(input)) return `This looks like document text, not a URL. ${sendFileInstead}`;
3091
+ return null;
3092
+ }
3093
+ // ../util/lib/contract/instance/document-url-schema.ts
3094
+ const documentUrlSchema = createFetchableUrlSchema((input) => {
3095
+ const hint = localDocumentUrlHint(String(input));
3096
+ return hint ? `URL must use http or https. ${hint}` : "URL must use http or https";
3097
+ });
3073
3098
  // ../util/lib/contract/instance/router/bankStatement/get-default-spec.ts
3074
3099
  function getDefaultSpec$3(op, requestExamples) {
3075
3100
  op["security"] = [{ bearerAuth: [] }];
@@ -3092,7 +3117,7 @@ function getDefaultSpec$3(op, requestExamples) {
3092
3117
  // ../util/lib/contract/instance/router/bankStatement/ask.ts
3093
3118
  const specializedModelSchema$5 = zod.z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3094
3119
  const askInputSchema$3 = zod.z.object({
3095
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3120
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3096
3121
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3097
3122
  base64: zod.z.string().optional().describe("Base64-encoded bank statement file content"),
3098
3123
  question: zod.z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the bank statement"),
@@ -3145,7 +3170,7 @@ const jsonSchemaInput = zod.z.union([schemaObject, zod.z.string().transform((str
3145
3170
  // ../util/lib/contract/instance/router/bankStatement/extract.ts
3146
3171
  const specializedModelSchema$4 = zod.z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3147
3172
  const extractInputSchema$3 = zod.z.object({
3148
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3173
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3149
3174
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3150
3175
  base64: zod.z.string().optional().describe("Base64-encoded bank statement file content"),
3151
3176
  prompt: zod.z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the bank statement"),
@@ -3208,7 +3233,7 @@ const specializedParseModelSchema$2 = zod.z.enum([
3208
3233
  "auto"
3209
3234
  ], { message: "model must be one of: pro, max, auto" }).default("auto");
3210
3235
  const parseInputSchema$3 = zod.z.object({
3211
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3236
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3212
3237
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3213
3238
  base64: zod.z.string().optional().describe("Base64-encoded bank statement file content"),
3214
3239
  model: specializedParseModelSchema$2.describe(specializedParseModelDescription("bank statement")),
@@ -3278,7 +3303,7 @@ function getDefaultSpec$2(op, requestExamples) {
3278
3303
  }
3279
3304
  // ../util/lib/contract/instance/router/document/ask.ts
3280
3305
  const askInputSchema$2 = zod.z.object({
3281
- url: fetchableUrlSchema.optional().describe("URL of the document file to fetch and parse"),
3306
+ url: documentUrlSchema.optional().describe("URL of the document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3282
3307
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3283
3308
  base64: zod.z.string().optional().describe("Base64-encoded document file content"),
3284
3309
  question: zod.z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the document"),
@@ -3354,7 +3379,7 @@ const ask$2 = oc.route({
3354
3379
  }).input(askInputSchema$2).output(askOutputSchema$2);
3355
3380
  // ../util/lib/contract/instance/router/document/extract.ts
3356
3381
  const extractInputSchema$2 = zod.z.object({
3357
- url: fetchableUrlSchema.optional().describe("URL of the document file to fetch and parse"),
3382
+ url: documentUrlSchema.optional().describe("URL of the document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3358
3383
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3359
3384
  base64: zod.z.string().optional().describe("Base64-encoded document file content"),
3360
3385
  prompt: zod.z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the document"),
@@ -3448,7 +3473,7 @@ const extract$2 = oc.route({
3448
3473
  }).input(extractInputSchema$2).output(extractOutputSchema$2);
3449
3474
  // ../util/lib/contract/instance/router/document/parse.ts
3450
3475
  const parseInputSchema$2 = zod.z.object({
3451
- url: fetchableUrlSchema.optional().describe("URL of the document file to fetch and parse"),
3476
+ url: documentUrlSchema.optional().describe("URL of the document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3452
3477
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3453
3478
  base64: zod.z.string().optional().describe("Base64-encoded document file content"),
3454
3479
  model: zod.z.enum(["auto", ...pdfvectorModelSchema.options]).optional().default("auto").describe(documentParseModelDescription),
@@ -3556,7 +3581,7 @@ var document_exports = /* @__PURE__ */ __exportAll({
3556
3581
  const MB$1 = 1048576;
3557
3582
  const limits$1 = freeTierLimits.bankStatementParse;
3558
3583
  const inputSchema$3 = zod.z.object({
3559
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3584
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3560
3585
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3561
3586
  base64: zod.z.string().optional().describe("Base64-encoded bank statement file content")
3562
3587
  });
@@ -3605,7 +3630,7 @@ const bankStatementParse = oc.route({
3605
3630
  const MB = 1048576;
3606
3631
  const limits = freeTierLimits.documentParse;
3607
3632
  const inputSchema$2 = zod.z.object({
3608
- url: fetchableUrlSchema.optional().describe("URL of the document to fetch and parse"),
3633
+ url: documentUrlSchema.optional().describe("URL of the document to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3609
3634
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3610
3635
  base64: zod.z.string().optional().describe("Base64-encoded document content")
3611
3636
  });
@@ -3877,7 +3902,7 @@ function getDefaultSpec$1(op, requestExamples) {
3877
3902
  // ../util/lib/contract/instance/router/identity/ask.ts
3878
3903
  const specializedModelSchema$3 = zod.z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3879
3904
  const askInputSchema$1 = zod.z.object({
3880
- url: fetchableUrlSchema.optional().describe("URL of the identity document file to fetch and parse"),
3905
+ url: documentUrlSchema.optional().describe("URL of the identity document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3881
3906
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3882
3907
  base64: zod.z.string().optional().describe("Base64-encoded identity document file content"),
3883
3908
  question: zod.z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the identity document"),
@@ -3925,7 +3950,7 @@ const ask$1 = oc.route({
3925
3950
  // ../util/lib/contract/instance/router/identity/extract.ts
3926
3951
  const specializedModelSchema$2 = zod.z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3927
3952
  const extractInputSchema$1 = zod.z.object({
3928
- url: fetchableUrlSchema.optional().describe("URL of the identity document file to fetch and parse"),
3953
+ url: documentUrlSchema.optional().describe("URL of the identity document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3929
3954
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3930
3955
  base64: zod.z.string().optional().describe("Base64-encoded identity document file content"),
3931
3956
  prompt: zod.z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the identity document"),
@@ -3982,7 +4007,7 @@ const specializedParseModelSchema$1 = zod.z.enum([
3982
4007
  "auto"
3983
4008
  ], { message: "model must be one of: pro, max, auto" }).default("auto");
3984
4009
  const parseInputSchema$1 = zod.z.object({
3985
- url: fetchableUrlSchema.optional().describe("URL of the identity document file to fetch and parse"),
4010
+ url: documentUrlSchema.optional().describe("URL of the identity document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3986
4011
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3987
4012
  base64: zod.z.string().optional().describe("Base64-encoded identity document file content"),
3988
4013
  model: specializedParseModelSchema$1.describe(specializedParseModelDescription("identity document")),
@@ -4054,7 +4079,7 @@ function getDefaultSpec(op, requestExamples) {
4054
4079
  // ../util/lib/contract/instance/router/invoice/ask.ts
4055
4080
  const specializedModelSchema$1 = zod.z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
4056
4081
  const askInputSchema = zod.z.object({
4057
- url: fetchableUrlSchema.optional().describe("URL of the invoice file to fetch and parse"),
4082
+ url: documentUrlSchema.optional().describe("URL of the invoice file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
4058
4083
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Invoice file upload via multipart form-data (${supportedFileFormatsDescription})`),
4059
4084
  base64: zod.z.string().optional().describe("Base64-encoded invoice file content"),
4060
4085
  question: zod.z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the invoice"),
@@ -4093,7 +4118,7 @@ const ask = oc.route({
4093
4118
  // ../util/lib/contract/instance/router/invoice/extract.ts
4094
4119
  const specializedModelSchema = zod.z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
4095
4120
  const extractInputSchema = zod.z.object({
4096
- url: fetchableUrlSchema.optional().describe("URL of the invoice file to fetch and parse"),
4121
+ url: documentUrlSchema.optional().describe("URL of the invoice file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
4097
4122
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Invoice file upload via multipart form-data (${supportedFileFormatsDescription})`),
4098
4123
  base64: zod.z.string().optional().describe("Base64-encoded invoice file content"),
4099
4124
  prompt: zod.z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the invoice"),
@@ -4113,34 +4138,59 @@ const extractOutputSchema = zod.z.object({
4113
4138
  requestId: zod.z.number().int().describe("Unique request identifier for this API call"),
4114
4139
  documentId: zod.z.string().optional().describe("Document ID if provided via x-pdfvector-document-id header or request body")
4115
4140
  });
4116
- const requestExamples$1 = { "Extract from URL": {
4117
- summary: "Extract from URL",
4118
- value: {
4119
- url: "https://example.com/invoice.pdf",
4120
- prompt: "Extract the vendor name, total amount, and line items",
4121
- schema: JSON.stringify({
4122
- type: "object",
4123
- properties: {
4124
- vendorName: { type: "string" },
4125
- totalAmount: { type: "number" },
4126
- lineItems: {
4141
+ const requestExamples$1 = {
4142
+ "Extract from URL": {
4143
+ summary: "Extract from URL",
4144
+ value: {
4145
+ url: "https://example.com/invoice.pdf",
4146
+ prompt: "Extract the vendor name, total amount, and line items",
4147
+ schema: JSON.stringify({
4148
+ type: "object",
4149
+ properties: {
4150
+ vendorName: { type: "string" },
4151
+ totalAmount: { type: "number" },
4152
+ lineItems: {
4153
+ type: "array",
4154
+ items: {
4155
+ type: "object",
4156
+ properties: {
4157
+ description: { type: "string" },
4158
+ amount: { type: "number" }
4159
+ }
4160
+ }
4161
+ }
4162
+ },
4163
+ required: ["vendorName", "totalAmount"]
4164
+ })
4165
+ }
4166
+ },
4167
+ "Many invoices in one PDF": {
4168
+ summary: "Many invoices in one PDF",
4169
+ value: {
4170
+ url: "https://example.com/batched-invoices.pdf",
4171
+ prompt: "Extract every invoice in the file as a separate item, one per invoice number",
4172
+ schema: JSON.stringify({
4173
+ type: "object",
4174
+ properties: { invoices: {
4127
4175
  type: "array",
4128
4176
  items: {
4129
4177
  type: "object",
4130
4178
  properties: {
4131
- description: { type: "string" },
4132
- amount: { type: "number" }
4133
- }
4179
+ invoiceNumber: { type: "string" },
4180
+ vendorName: { type: "string" },
4181
+ totalAmount: { type: "number" }
4182
+ },
4183
+ required: ["invoiceNumber", "totalAmount"]
4134
4184
  }
4135
- }
4136
- },
4137
- required: ["vendorName", "totalAmount"]
4138
- })
4185
+ } },
4186
+ required: ["invoices"]
4187
+ })
4188
+ }
4139
4189
  }
4140
- } };
4190
+ };
4141
4191
  const extract = oc.route({
4142
4192
  summary: "Extract structured data from an invoice",
4143
- description: `Parse an invoice and extract structured data matching a provided JSON Schema using AI. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string.`,
4193
+ description: `Parse an invoice and extract structured data matching a provided JSON Schema using AI. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string. For a file that holds several invoices, make the schema an object with an array property of invoice objects (see the "Many invoices in one PDF" example) to get one item per invoice.`,
4144
4194
  tags: ["Invoice"],
4145
4195
  spec: (op) => {
4146
4196
  const spec = getDefaultSpec(op, requestExamples$1);
@@ -4155,7 +4205,7 @@ const specializedParseModelSchema = zod.z.enum([
4155
4205
  "auto"
4156
4206
  ], { message: "model must be one of: pro, max, auto" }).default("auto");
4157
4207
  const parseInputSchema = zod.z.object({
4158
- url: fetchableUrlSchema.optional().describe("URL of the invoice file to fetch and parse"),
4208
+ url: documentUrlSchema.optional().describe("URL of the invoice file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
4159
4209
  file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Invoice file upload via multipart form-data (${supportedFileFormatsDescription})`),
4160
4210
  base64: zod.z.string().optional().describe("Base64-encoded invoice file content"),
4161
4211
  model: specializedParseModelSchema.describe(specializedParseModelDescription("invoice")),
@@ -1160,7 +1160,7 @@ declare const paperGraph: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1160
1160
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1161
1161
  declare const parse$4: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1162
1162
  id: z.ZodOptional<z.ZodString>;
1163
- url: z.ZodOptional<z.ZodURL>;
1163
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1164
1164
  model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1165
1165
  auto: "auto";
1166
1166
  max: "max";
@@ -1170,7 +1170,7 @@ declare const parse$4: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1170
1170
  }>>>;
1171
1171
  includePages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1172
1172
  callback: z.ZodOptional<z.ZodObject<{
1173
- url: z.ZodURL;
1173
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1174
1174
  type: z.ZodOptional<z.ZodString>;
1175
1175
  }, z.core.$strip>>;
1176
1176
  }, z.core.$strip>, z.ZodObject<{
@@ -1766,7 +1766,7 @@ declare namespace index_d_exports$6 {
1766
1766
  export { validateCredential };
1767
1767
  }
1768
1768
  declare const ask$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1769
- url: z.ZodOptional<z.ZodURL>;
1769
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1770
1770
  file: z.ZodOptional<z.ZodFile>;
1771
1771
  base64: z.ZodOptional<z.ZodString>;
1772
1772
  question: z.ZodString;
@@ -1779,7 +1779,7 @@ declare const ask$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1779
1779
  }>>;
1780
1780
  documentId: z.ZodOptional<z.ZodString>;
1781
1781
  callback: z.ZodOptional<z.ZodObject<{
1782
- url: z.ZodURL;
1782
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1783
1783
  type: z.ZodOptional<z.ZodString>;
1784
1784
  }, z.core.$strip>>;
1785
1785
  }, z.core.$strip>, z.ZodObject<{
@@ -1796,7 +1796,7 @@ declare const ask$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1796
1796
  documentId: z.ZodOptional<z.ZodString>;
1797
1797
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1798
1798
  declare const extract$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1799
- url: z.ZodOptional<z.ZodURL>;
1799
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1800
1800
  file: z.ZodOptional<z.ZodFile>;
1801
1801
  base64: z.ZodOptional<z.ZodString>;
1802
1802
  prompt: z.ZodString;
@@ -1810,7 +1810,7 @@ declare const extract$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1810
1810
  }>>;
1811
1811
  documentId: z.ZodOptional<z.ZodString>;
1812
1812
  callback: z.ZodOptional<z.ZodObject<{
1813
- url: z.ZodURL;
1813
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1814
1814
  type: z.ZodOptional<z.ZodString>;
1815
1815
  }, z.core.$strip>>;
1816
1816
  }, z.core.$strip>, z.ZodObject<{
@@ -1827,7 +1827,7 @@ declare const extract$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1827
1827
  documentId: z.ZodOptional<z.ZodString>;
1828
1828
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1829
1829
  declare const parse$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1830
- url: z.ZodOptional<z.ZodURL>;
1830
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1831
1831
  file: z.ZodOptional<z.ZodFile>;
1832
1832
  base64: z.ZodOptional<z.ZodString>;
1833
1833
  model: z.ZodDefault<z.ZodEnum<{
@@ -1837,7 +1837,7 @@ declare const parse$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1837
1837
  }>>;
1838
1838
  documentId: z.ZodOptional<z.ZodString>;
1839
1839
  callback: z.ZodOptional<z.ZodObject<{
1840
- url: z.ZodURL;
1840
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1841
1841
  type: z.ZodOptional<z.ZodString>;
1842
1842
  }, z.core.$strip>>;
1843
1843
  }, z.core.$strip>, z.ZodObject<{
@@ -1856,7 +1856,7 @@ declare namespace index_d_exports$5 {
1856
1856
  export { ask$3 as ask, extract$3 as extract, parse$3 as parse };
1857
1857
  }
1858
1858
  declare const ask$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1859
- url: z.ZodOptional<z.ZodURL>;
1859
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1860
1860
  file: z.ZodOptional<z.ZodFile>;
1861
1861
  base64: z.ZodOptional<z.ZodString>;
1862
1862
  question: z.ZodString;
@@ -1869,7 +1869,7 @@ declare const ask$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1869
1869
  }>>>;
1870
1870
  documentId: z.ZodOptional<z.ZodString>;
1871
1871
  callback: z.ZodOptional<z.ZodObject<{
1872
- url: z.ZodURL;
1872
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1873
1873
  type: z.ZodOptional<z.ZodString>;
1874
1874
  }, z.core.$strip>>;
1875
1875
  }, z.core.$strip>, z.ZodObject<{
@@ -1886,7 +1886,7 @@ declare const ask$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1886
1886
  documentId: z.ZodOptional<z.ZodString>;
1887
1887
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1888
1888
  declare const extract$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1889
- url: z.ZodOptional<z.ZodURL>;
1889
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1890
1890
  file: z.ZodOptional<z.ZodFile>;
1891
1891
  base64: z.ZodOptional<z.ZodString>;
1892
1892
  prompt: z.ZodString;
@@ -1900,7 +1900,7 @@ declare const extract$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1900
1900
  }>>>;
1901
1901
  documentId: z.ZodOptional<z.ZodString>;
1902
1902
  callback: z.ZodOptional<z.ZodObject<{
1903
- url: z.ZodURL;
1903
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1904
1904
  type: z.ZodOptional<z.ZodString>;
1905
1905
  }, z.core.$strip>>;
1906
1906
  }, z.core.$strip>, z.ZodObject<{
@@ -1917,7 +1917,7 @@ declare const extract$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1917
1917
  documentId: z.ZodOptional<z.ZodString>;
1918
1918
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1919
1919
  declare const parse$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1920
- url: z.ZodOptional<z.ZodURL>;
1920
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1921
1921
  file: z.ZodOptional<z.ZodFile>;
1922
1922
  base64: z.ZodOptional<z.ZodString>;
1923
1923
  model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
@@ -1933,7 +1933,7 @@ declare const parse$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1933
1933
  }>, z.ZodTransform<boolean, "false" | "true">>]>>>;
1934
1934
  documentId: z.ZodOptional<z.ZodString>;
1935
1935
  callback: z.ZodOptional<z.ZodObject<{
1936
- url: z.ZodURL;
1936
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1937
1937
  type: z.ZodOptional<z.ZodString>;
1938
1938
  }, z.core.$strip>>;
1939
1939
  }, z.core.$strip>, z.ZodObject<{
@@ -1983,7 +1983,7 @@ declare namespace index_d_exports$4 {
1983
1983
  export { ask$2 as ask, extract$2 as extract, parse$2 as parse };
1984
1984
  }
1985
1985
  declare const bankStatementParse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1986
- url: z.ZodOptional<z.ZodURL>;
1986
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1987
1987
  file: z.ZodOptional<z.ZodFile>;
1988
1988
  base64: z.ZodOptional<z.ZodString>;
1989
1989
  }, z.core.$strip>, z.ZodObject<{
@@ -1997,7 +1997,7 @@ declare const bankStatementParse: ContractProcedureBuilderWithInputOutput<z.ZodO
1997
1997
  html: z.ZodOptional<z.ZodString>;
1998
1998
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1999
1999
  declare const documentParse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2000
- url: z.ZodOptional<z.ZodURL>;
2000
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2001
2001
  file: z.ZodOptional<z.ZodFile>;
2002
2002
  base64: z.ZodOptional<z.ZodString>;
2003
2003
  }, z.core.$strip>, z.ZodObject<{
@@ -2054,7 +2054,7 @@ declare namespace index_d_exports$3 {
2054
2054
  export { bankStatementParse, documentParse, generateSchema, publicationPdfUrl, rateLimitStatus };
2055
2055
  }
2056
2056
  declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2057
- url: z.ZodOptional<z.ZodURL>;
2057
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2058
2058
  file: z.ZodOptional<z.ZodFile>;
2059
2059
  base64: z.ZodOptional<z.ZodString>;
2060
2060
  question: z.ZodString;
@@ -2067,7 +2067,7 @@ declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2067
2067
  }>>;
2068
2068
  documentId: z.ZodOptional<z.ZodString>;
2069
2069
  callback: z.ZodOptional<z.ZodObject<{
2070
- url: z.ZodURL;
2070
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2071
2071
  type: z.ZodOptional<z.ZodString>;
2072
2072
  }, z.core.$strip>>;
2073
2073
  }, z.core.$strip>, z.ZodObject<{
@@ -2084,7 +2084,7 @@ declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2084
2084
  documentId: z.ZodOptional<z.ZodString>;
2085
2085
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2086
2086
  declare const extract$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2087
- url: z.ZodOptional<z.ZodURL>;
2087
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2088
2088
  file: z.ZodOptional<z.ZodFile>;
2089
2089
  base64: z.ZodOptional<z.ZodString>;
2090
2090
  prompt: z.ZodString;
@@ -2098,7 +2098,7 @@ declare const extract$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2098
2098
  }>>;
2099
2099
  documentId: z.ZodOptional<z.ZodString>;
2100
2100
  callback: z.ZodOptional<z.ZodObject<{
2101
- url: z.ZodURL;
2101
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2102
2102
  type: z.ZodOptional<z.ZodString>;
2103
2103
  }, z.core.$strip>>;
2104
2104
  }, z.core.$strip>, z.ZodObject<{
@@ -2115,7 +2115,7 @@ declare const extract$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2115
2115
  documentId: z.ZodOptional<z.ZodString>;
2116
2116
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2117
2117
  declare const parse$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2118
- url: z.ZodOptional<z.ZodURL>;
2118
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2119
2119
  file: z.ZodOptional<z.ZodFile>;
2120
2120
  base64: z.ZodOptional<z.ZodString>;
2121
2121
  model: z.ZodDefault<z.ZodEnum<{
@@ -2125,7 +2125,7 @@ declare const parse$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2125
2125
  }>>;
2126
2126
  documentId: z.ZodOptional<z.ZodString>;
2127
2127
  callback: z.ZodOptional<z.ZodObject<{
2128
- url: z.ZodURL;
2128
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2129
2129
  type: z.ZodOptional<z.ZodString>;
2130
2130
  }, z.core.$strip>>;
2131
2131
  }, z.core.$strip>, z.ZodObject<{
@@ -2145,7 +2145,7 @@ declare namespace index_d_exports$2 {
2145
2145
  export { ask$1 as ask, extract$1 as extract, parse$1 as parse };
2146
2146
  }
2147
2147
  declare const ask: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2148
- url: z.ZodOptional<z.ZodURL>;
2148
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2149
2149
  file: z.ZodOptional<z.ZodFile>;
2150
2150
  base64: z.ZodOptional<z.ZodString>;
2151
2151
  question: z.ZodString;
@@ -2158,7 +2158,7 @@ declare const ask: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2158
2158
  }>>;
2159
2159
  documentId: z.ZodOptional<z.ZodString>;
2160
2160
  callback: z.ZodOptional<z.ZodObject<{
2161
- url: z.ZodURL;
2161
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2162
2162
  type: z.ZodOptional<z.ZodString>;
2163
2163
  }, z.core.$strip>>;
2164
2164
  }, z.core.$strip>, z.ZodObject<{
@@ -2175,7 +2175,7 @@ declare const ask: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2175
2175
  documentId: z.ZodOptional<z.ZodString>;
2176
2176
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2177
2177
  declare const extract: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2178
- url: z.ZodOptional<z.ZodURL>;
2178
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2179
2179
  file: z.ZodOptional<z.ZodFile>;
2180
2180
  base64: z.ZodOptional<z.ZodString>;
2181
2181
  prompt: z.ZodString;
@@ -2189,7 +2189,7 @@ declare const extract: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2189
2189
  }>>;
2190
2190
  documentId: z.ZodOptional<z.ZodString>;
2191
2191
  callback: z.ZodOptional<z.ZodObject<{
2192
- url: z.ZodURL;
2192
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2193
2193
  type: z.ZodOptional<z.ZodString>;
2194
2194
  }, z.core.$strip>>;
2195
2195
  }, z.core.$strip>, z.ZodObject<{
@@ -2206,7 +2206,7 @@ declare const extract: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2206
2206
  documentId: z.ZodOptional<z.ZodString>;
2207
2207
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2208
2208
  declare const parse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2209
- url: z.ZodOptional<z.ZodURL>;
2209
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2210
2210
  file: z.ZodOptional<z.ZodFile>;
2211
2211
  base64: z.ZodOptional<z.ZodString>;
2212
2212
  model: z.ZodDefault<z.ZodEnum<{
@@ -2216,7 +2216,7 @@ declare const parse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2216
2216
  }>>;
2217
2217
  documentId: z.ZodOptional<z.ZodString>;
2218
2218
  callback: z.ZodOptional<z.ZodObject<{
2219
- url: z.ZodURL;
2219
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2220
2220
  type: z.ZodOptional<z.ZodString>;
2221
2221
  }, z.core.$strip>>;
2222
2222
  }, z.core.$strip>, z.ZodObject<{