@pdfvector/client 0.1.3 → 0.2.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/CHANGELOG.md +11 -0
- package/README.md +7 -1
- package/dist/contract.cjs +174 -65
- package/dist/contract.d.cts +22 -1
- package/dist/contract.d.mts +22 -1
- package/dist/contract.mjs +174 -65
- 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 +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @pdfvector/client
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#691](https://github.com/phuctm97/pdfvector/pull/691) [`69e9221`](https://github.com/phuctm97/pdfvector/commit/69e9221bd12b0d941b8809652d4a564ffca1bb8c) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Errors that need a different model now name it: the API returns `data.suggestedModel`, the SDK exposes `error.suggestedModel`, and Make shows it in the error message.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`69e9221`](https://github.com/phuctm97/pdfvector/commit/69e9221bd12b0d941b8809652d4a564ffca1bb8c)]:
|
|
12
|
+
- @pdfvector/instance-client@0.2.0
|
|
13
|
+
|
|
3
14
|
## 0.1.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -635,7 +635,7 @@ console.log(resultB.documentId); // "doc-b"
|
|
|
635
635
|
|
|
636
636
|
All API errors are thrown as `PDFVectorError` instances. The SDK maps server errors into specific subclasses and adds user/agent-friendly fields such as `title`, `suggestion`, `userError`, retry flags, and `requestId`.
|
|
637
637
|
|
|
638
|
-
For `INTERNAL_SERVER_ERROR`, the API returns a safe message and keeps the original provider failure in server diagnostics. Use `requestId` when contacting support. For document processing failures, check `reasonCode` and `
|
|
638
|
+
For `INTERNAL_SERVER_ERROR`, the API returns a safe message and keeps the original provider failure in server diagnostics. Use `requestId` when contacting support. For document processing failures, check `reasonCode`, `retryableWithHigherModel` and `suggestedModel` instead of parsing the message; `EXTRACTION_FAILED` identifies unusable structured output even if message wording changes. `DOCUMENT_PROCESSING_FAILED` identifies a processing rejection that was not confirmed to be a caller-input error, so the SDK suggests retrying or contacting support rather than changing the document. Error responses do not include raw AI output.
|
|
639
639
|
|
|
640
640
|
Reason codes (`reasonCode`, from the response's `data.code`) for document input:
|
|
641
641
|
|
|
@@ -697,6 +697,11 @@ try {
|
|
|
697
697
|
if (isPDFVectorError(error) && error.retryableWithHigherModel) {
|
|
698
698
|
console.error("Retry with a stronger model or a smaller document.");
|
|
699
699
|
}
|
|
700
|
+
|
|
701
|
+
// e.g. "mini" for a scanned PDF sent to nano, "auto" for a document over the 30-page limit
|
|
702
|
+
if (isPDFVectorError(error) && error.suggestedModel) {
|
|
703
|
+
console.error(`Retry with model ${error.suggestedModel}.`);
|
|
704
|
+
}
|
|
700
705
|
}
|
|
701
706
|
```
|
|
702
707
|
|
|
@@ -834,6 +839,7 @@ PDFVectorError
|
|
|
834
839
|
| `userError` | `boolean` | `true` for expected caller-fixable failures |
|
|
835
840
|
| `retryable` | `boolean` | `true` when retrying may help |
|
|
836
841
|
| `retryableWithHigherModel` | `boolean` | `true` when retrying with a stronger model or smaller document may help |
|
|
842
|
+
| `suggestedModel` | `string \| undefined` | Model to retry with when the server names one (`data.suggestedModel`): the next tier after a model that could not read the document, `auto` for files over the tier's page or size limit that fit auto's (no suggestion when nothing fits), the lowest tier that supports the file type. It does not change `retryable` or `retryableWithHigherModel` |
|
|
837
843
|
| `requestId` | `number \| undefined` | Server-assigned request ID; include in support tickets |
|
|
838
844
|
| `documentId` | `string \| undefined` | Echoed back if you passed `context.documentId` |
|
|
839
845
|
| `reasonCode` | `string \| undefined` | More specific server reason when available, such as `NO_PUBLIC_PDF` |
|
package/dist/contract.cjs
CHANGED
|
@@ -375,6 +375,38 @@ const oc = new class ContractBuilder extends ContractProcedure {
|
|
|
375
375
|
route: {},
|
|
376
376
|
meta: {}
|
|
377
377
|
});
|
|
378
|
+
// ../util/lib/academic-providers.ts
|
|
379
|
+
/** Academic search providers, in the order the API lists them. Single source for the contract and marketing copy. */
|
|
380
|
+
const academicProviders = [
|
|
381
|
+
"semantic-scholar",
|
|
382
|
+
"pubmed",
|
|
383
|
+
"arxiv",
|
|
384
|
+
"google-scholar",
|
|
385
|
+
"eric",
|
|
386
|
+
"europe-pmc",
|
|
387
|
+
"openalex",
|
|
388
|
+
"crossref"
|
|
389
|
+
];
|
|
390
|
+
const numberWords = [
|
|
391
|
+
"zero",
|
|
392
|
+
"one",
|
|
393
|
+
"two",
|
|
394
|
+
"three",
|
|
395
|
+
"four",
|
|
396
|
+
"five",
|
|
397
|
+
"six",
|
|
398
|
+
"seven",
|
|
399
|
+
"eight",
|
|
400
|
+
"nine",
|
|
401
|
+
"ten",
|
|
402
|
+
"eleven",
|
|
403
|
+
"twelve"
|
|
404
|
+
];
|
|
405
|
+
/** English word for small counts in marketing copy ("eight"); digits past twelve. */
|
|
406
|
+
function countWord(count) {
|
|
407
|
+
return numberWords[count] ?? String(count);
|
|
408
|
+
}
|
|
409
|
+
countWord(academicProviders.length);
|
|
378
410
|
// ../util/lib/api-source.ts
|
|
379
411
|
const apiSources = [
|
|
380
412
|
"make",
|
|
@@ -387,27 +419,44 @@ const apiSources = [
|
|
|
387
419
|
"unknown",
|
|
388
420
|
"internal"
|
|
389
421
|
];
|
|
422
|
+
// ../util/lib/free-tier.ts
|
|
423
|
+
const MB$3 = 1048576;
|
|
424
|
+
const freeTierLimits = {
|
|
425
|
+
bankStatementParse: {
|
|
426
|
+
dailyLimit: 5,
|
|
427
|
+
maxFileSize: 5 * MB$3,
|
|
428
|
+
maxPages: 5
|
|
429
|
+
},
|
|
430
|
+
documentParse: {
|
|
431
|
+
dailyLimit: 20,
|
|
432
|
+
maxFileSize: 5 * MB$3,
|
|
433
|
+
maxPages: 50,
|
|
434
|
+
maxOcrPages: 5
|
|
435
|
+
},
|
|
436
|
+
generateSchema: { dailyLimit: 10 },
|
|
437
|
+
publicationPdfUrl: { dailyLimit: 20 }
|
|
438
|
+
};
|
|
390
439
|
// ../util/lib/tier.ts
|
|
391
|
-
const MB = 1048576;
|
|
440
|
+
const MB$2 = 1048576;
|
|
392
441
|
const tierLimits = {
|
|
393
442
|
nano: {
|
|
394
|
-
maxFileSize: 40 * MB,
|
|
443
|
+
maxFileSize: 40 * MB$2,
|
|
395
444
|
maxPages: 30
|
|
396
445
|
},
|
|
397
446
|
mini: {
|
|
398
|
-
maxFileSize: 40 * MB,
|
|
447
|
+
maxFileSize: 40 * MB$2,
|
|
399
448
|
maxPages: 30
|
|
400
449
|
},
|
|
401
450
|
pro: {
|
|
402
|
-
maxFileSize: 40 * MB,
|
|
451
|
+
maxFileSize: 40 * MB$2,
|
|
403
452
|
maxPages: 30
|
|
404
453
|
},
|
|
405
454
|
max: {
|
|
406
|
-
maxFileSize: 500 * MB,
|
|
455
|
+
maxFileSize: 500 * MB$2,
|
|
407
456
|
maxPages: 2e3
|
|
408
457
|
},
|
|
409
458
|
auto: {
|
|
410
|
-
maxFileSize: 500 * MB,
|
|
459
|
+
maxFileSize: 500 * MB$2,
|
|
411
460
|
maxPages: 2e3
|
|
412
461
|
}
|
|
413
462
|
};
|
|
@@ -1408,7 +1457,7 @@ print(data["data"])`,
|
|
|
1408
1457
|
"offset": 0,
|
|
1409
1458
|
"yearFrom": 2017,
|
|
1410
1459
|
"yearTo": 2025,
|
|
1411
|
-
"fields": ["title", "authors", "year", "doi", "
|
|
1460
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"]
|
|
1412
1461
|
}'`,
|
|
1413
1462
|
typescript: `import { createClient } from "@pdfvector/client";
|
|
1414
1463
|
|
|
@@ -1440,7 +1489,7 @@ response = requests.post(
|
|
|
1440
1489
|
"offset": 0,
|
|
1441
1490
|
"yearFrom": 2017,
|
|
1442
1491
|
"yearTo": 2025,
|
|
1443
|
-
"fields": ["title", "authors", "year", "doi", "
|
|
1492
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"],
|
|
1444
1493
|
},
|
|
1445
1494
|
)
|
|
1446
1495
|
data = response.json()
|
|
@@ -1478,7 +1527,7 @@ print(f"Found {data['estimatedTotalResults']} results")`,
|
|
|
1478
1527
|
-H "Content-Type: application/json" \\
|
|
1479
1528
|
-d '{
|
|
1480
1529
|
"ids": ["10.1038/s41586-021-03819-2", "2303.08774", "PMID:33116299"],
|
|
1481
|
-
"fields": ["title", "authors", "year", "doi", "abstract", "
|
|
1530
|
+
"fields": ["title", "authors", "year", "doi", "abstract", "totalCitations"]
|
|
1482
1531
|
}'`,
|
|
1483
1532
|
typescript: `import { createClient } from "@pdfvector/client";
|
|
1484
1533
|
|
|
@@ -1499,7 +1548,7 @@ response = requests.post(
|
|
|
1499
1548
|
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1500
1549
|
json={
|
|
1501
1550
|
"ids": ["10.1038/s41586-021-03819-2", "2303.08774", "PMID:33116299"],
|
|
1502
|
-
"fields": ["title", "authors", "year", "doi", "abstract", "
|
|
1551
|
+
"fields": ["title", "authors", "year", "doi", "abstract", "totalCitations"],
|
|
1503
1552
|
},
|
|
1504
1553
|
)
|
|
1505
1554
|
for paper in response.json()["results"]:
|
|
@@ -1563,7 +1612,7 @@ for paper in response.json()["results"]:
|
|
|
1563
1612
|
-d '{
|
|
1564
1613
|
"paragraph": "Large language models have demonstrated remarkable few-shot learning capabilities across a wide range of NLP tasks. The scaling of transformer architectures to billions of parameters has led to emergent abilities not observed in smaller models.",
|
|
1565
1614
|
"providers": ["semantic-scholar", "openalex"],
|
|
1566
|
-
"fields": ["title", "authors", "year", "doi", "
|
|
1615
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"]
|
|
1567
1616
|
}'`,
|
|
1568
1617
|
typescript: `import { createClient } from "@pdfvector/client";
|
|
1569
1618
|
|
|
@@ -1590,7 +1639,7 @@ response = requests.post(
|
|
|
1590
1639
|
json={
|
|
1591
1640
|
"paragraph": "Large language models have demonstrated remarkable few-shot learning capabilities across a wide range of NLP tasks. The scaling of transformer architectures to billions of parameters has led to emergent abilities not observed in smaller models.",
|
|
1592
1641
|
"providers": ["semantic-scholar", "openalex"],
|
|
1593
|
-
"fields": ["title", "authors", "year", "doi", "
|
|
1642
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"],
|
|
1594
1643
|
},
|
|
1595
1644
|
)
|
|
1596
1645
|
data = response.json()
|
|
@@ -1898,16 +1947,7 @@ function getOpenApiCodeSamples(id) {
|
|
|
1898
1947
|
const documentParseOpenApiCodeSamples = getOpenApiCodeSamples("document-parse");
|
|
1899
1948
|
const academicParseOpenApiCodeSamples = getOpenApiCodeSamples("academic-parse");
|
|
1900
1949
|
// ../util/lib/contract/instance/router/academic/provider.ts
|
|
1901
|
-
const providerSchema = zod.z.enum(
|
|
1902
|
-
"semantic-scholar",
|
|
1903
|
-
"pubmed",
|
|
1904
|
-
"arxiv",
|
|
1905
|
-
"google-scholar",
|
|
1906
|
-
"eric",
|
|
1907
|
-
"europe-pmc",
|
|
1908
|
-
"openalex",
|
|
1909
|
-
"crossref"
|
|
1910
|
-
], { message: "Invalid provider. Must be one of: semantic-scholar, pubmed, arxiv, google-scholar, eric, europe-pmc, openalex, crossref" });
|
|
1950
|
+
const providerSchema = zod.z.enum(academicProviders, { message: `Invalid provider. Must be one of: ${academicProviders.join(", ")}` });
|
|
1911
1951
|
const grantProviderSchema = zod.z.enum([
|
|
1912
1952
|
"grants-gov",
|
|
1913
1953
|
"nih-reporter",
|
|
@@ -1941,7 +1981,7 @@ const fetchErrorSchema = zod.z.object({
|
|
|
1941
1981
|
error: zod.z.string(),
|
|
1942
1982
|
code: zod.z.string().nullish()
|
|
1943
1983
|
});
|
|
1944
|
-
const requestExamples$
|
|
1984
|
+
const requestExamples$22 = {
|
|
1945
1985
|
"Fetch by DOI": {
|
|
1946
1986
|
summary: "Fetch a paper by DOI",
|
|
1947
1987
|
value: { ids: ["10.1038/nature12373"] }
|
|
@@ -1991,7 +2031,7 @@ const fetch = oc.input(zod.z.object({
|
|
|
1991
2031
|
spec: (op) => {
|
|
1992
2032
|
op.security = [{ bearerAuth: [] }];
|
|
1993
2033
|
const reqBody = op.requestBody;
|
|
1994
|
-
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$
|
|
2034
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$22;
|
|
1995
2035
|
op["x-codeSamples"] = getOpenApiCodeSamples("academic-fetch");
|
|
1996
2036
|
return op;
|
|
1997
2037
|
}
|
|
@@ -2021,7 +2061,7 @@ const sentenceCitationSchema = zod.z.object({
|
|
|
2021
2061
|
sentence: zod.z.string(),
|
|
2022
2062
|
citations: zod.z.array(scoredPublicationSchema)
|
|
2023
2063
|
});
|
|
2024
|
-
const requestExamples$
|
|
2064
|
+
const requestExamples$21 = {
|
|
2025
2065
|
"Find citations for a paragraph": {
|
|
2026
2066
|
summary: "Find citations for a research paragraph",
|
|
2027
2067
|
value: { paragraph: "Deep learning has revolutionized computer vision and natural language processing. Transformer architectures have become the dominant approach for sequence modeling tasks. Recent large language models demonstrate emergent capabilities not seen in smaller models." }
|
|
@@ -2069,7 +2109,7 @@ const findCitations = oc.input(zod.z.object({
|
|
|
2069
2109
|
spec: (op) => {
|
|
2070
2110
|
op.security = [{ bearerAuth: [] }];
|
|
2071
2111
|
const reqBody = op.requestBody;
|
|
2072
|
-
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$
|
|
2112
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$21;
|
|
2073
2113
|
op["x-codeSamples"] = getOpenApiCodeSamples("academic-find-citations");
|
|
2074
2114
|
return op;
|
|
2075
2115
|
}
|
|
@@ -2094,7 +2134,7 @@ const publicationSchema$2 = zod.z.object({
|
|
|
2094
2134
|
provider: providerSchema.nullish(),
|
|
2095
2135
|
providerData: zod.z.record(zod.z.string(), zod.z.unknown()).nullish()
|
|
2096
2136
|
});
|
|
2097
|
-
const requestExamples$
|
|
2137
|
+
const requestExamples$20 = {
|
|
2098
2138
|
"Get citations by DOI": {
|
|
2099
2139
|
summary: "Get citations and references for a paper by DOI",
|
|
2100
2140
|
value: {
|
|
@@ -2160,7 +2200,7 @@ const paperGraph = oc.input(zod.z.object({
|
|
|
2160
2200
|
spec: (op) => {
|
|
2161
2201
|
op.security = [{ bearerAuth: [] }];
|
|
2162
2202
|
const reqBody = op.requestBody;
|
|
2163
|
-
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$
|
|
2203
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$20;
|
|
2164
2204
|
op["x-codeSamples"] = getOpenApiCodeSamples("academic-paper-graph");
|
|
2165
2205
|
return op;
|
|
2166
2206
|
}
|
|
@@ -2239,10 +2279,17 @@ function tierDesc(tier, credits, unit, extra) {
|
|
|
2239
2279
|
}
|
|
2240
2280
|
const autoLimit = tierLimits["auto"];
|
|
2241
2281
|
if (!autoLimit) throw new Error("Missing auto tier limits");
|
|
2282
|
+
const autoLimitStr = `Up to ${autoLimit.maxPages} pages, ${fmtSize(autoLimit.maxFileSize)}.`;
|
|
2283
|
+
const proLimit = tierLimits["pro"];
|
|
2284
|
+
if (!proLimit) throw new Error("Missing pro tier limits");
|
|
2285
|
+
/** File limits for operation descriptions, from `tierLimits` (Auto/Max vs the 30-page tiers). */
|
|
2286
|
+
const fileLimitsDescription = `Files up to ${autoLimit.maxPages.toLocaleString("en-US")} pages and ${fmtSize(autoLimit.maxFileSize)} with the auto and max models; nano, mini and pro accept up to ${proLimit.maxPages} pages and ${fmtSize(proLimit.maxFileSize)}.`;
|
|
2287
|
+
/** Error field for callers that retry with another model (operation descriptions). */
|
|
2288
|
+
const suggestedModelDescription = "When the chosen model cannot handle the document (a scanned PDF on nano, an image on nano or mini, a file over the page or size limit, an unusable answer), the error response's `data.suggestedModel` names the model to retry with: the next tier up, `auto` for files over the tier's page or size limit that fit auto's, or the lowest tier that supports the file type.";
|
|
2242
2289
|
/** Model tier descriptions for document parse endpoints. */
|
|
2243
2290
|
const documentParseModelDescription = `Model tier for parsing.
|
|
2244
2291
|
|
|
2245
|
-
- auto (default): Intelligent fallback — credits based on the tier selected automatically. ${
|
|
2292
|
+
- auto (default): Intelligent fallback — credits based on the tier selected automatically. ${autoLimitStr}\n${tierDesc("nano", documentParseCosts.nano, "credit/page", "Simple plain text documents.")}\n${tierDesc("mini", documentParseCosts.mini, "credits/page", "Documents with tables and structured content.")}\n${tierDesc("pro", documentParseCosts.pro, "credits/page", "Tables, handwritten text, figures, math, Arabic, image support.")}\n${tierDesc("max", documentParseCosts.max, "credits/page", "Full Pro capabilities + enhanced multilingual.")}` + formatNote;
|
|
2246
2293
|
/** Model tier descriptions for document extract endpoints. */
|
|
2247
2294
|
const documentExtractModelDescription = `Model tier for extracting structured data.
|
|
2248
2295
|
|
|
@@ -2308,7 +2355,7 @@ const parseOutputSchema$4 = zod.z.object({
|
|
|
2308
2355
|
html: zod.z.string().optional().describe("Full HTML representation of the paper content. Only available when using the 'max' model."),
|
|
2309
2356
|
pages: zod.z.array(pageMarkdownSchema).optional().describe("Page-separated markdown content. Returned only when includePages is true.")
|
|
2310
2357
|
});
|
|
2311
|
-
const requestExamples$
|
|
2358
|
+
const requestExamples$19 = {
|
|
2312
2359
|
"Parse ArXiv paper by ID": {
|
|
2313
2360
|
summary: "Parse ArXiv paper by ID",
|
|
2314
2361
|
value: {
|
|
@@ -2341,12 +2388,12 @@ const requestExamples$18 = {
|
|
|
2341
2388
|
};
|
|
2342
2389
|
const parse$4 = oc.input(parseInputSchema$4).output(parseOutputSchema$4).route({
|
|
2343
2390
|
summary: "Parse an academic paper to markdown",
|
|
2344
|
-
description: "Resolve an academic paper URL or identifier to a public PDF URL, parse the PDF, and return markdown using the same model tiers as document.parse. Returns NOT_FOUND when the paper cannot be found or no public PDF is available.",
|
|
2391
|
+
description: "Resolve an academic paper URL or identifier to a public PDF URL, parse the PDF, and return markdown using the same model tiers as document.parse. When the first copy cannot be downloaded (for example a publisher that blocks automated downloads), other open-access copies are tried: arXiv, PubMed Central, and repository copies listed by OpenAlex; pdfURL in the response is the copy that was parsed. Returns NOT_FOUND when the paper cannot be found or no public PDF is available.",
|
|
2345
2392
|
tags: ["Academic"],
|
|
2346
2393
|
spec: (op) => {
|
|
2347
2394
|
op.security = [{ bearerAuth: [] }];
|
|
2348
2395
|
const reqBody = op.requestBody;
|
|
2349
|
-
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$
|
|
2396
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$19;
|
|
2350
2397
|
op["x-codeSamples"] = academicParseOpenApiCodeSamples;
|
|
2351
2398
|
return op;
|
|
2352
2399
|
}
|
|
@@ -2377,7 +2424,7 @@ const providerErrorSchema$1 = zod.z.object({
|
|
|
2377
2424
|
code: zod.z.string().nullish(),
|
|
2378
2425
|
details: zod.z.record(zod.z.string(), zod.z.unknown()).nullish()
|
|
2379
2426
|
});
|
|
2380
|
-
const requestExamples$
|
|
2427
|
+
const requestExamples$18 = {
|
|
2381
2428
|
"Search with default provider": {
|
|
2382
2429
|
summary: "Search with Semantic Scholar",
|
|
2383
2430
|
value: { query: "deep learning for natural language processing" }
|
|
@@ -2434,16 +2481,16 @@ const search = oc.input(zod.z.object({
|
|
|
2434
2481
|
})).output(zod.z.object({
|
|
2435
2482
|
estimatedTotalResults: zod.z.number(),
|
|
2436
2483
|
results: zod.z.array(publicationSchema$1),
|
|
2437
|
-
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.
|
|
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."),
|
|
2438
2485
|
requestId: zod.z.number().int()
|
|
2439
2486
|
})).route({
|
|
2440
2487
|
summary: "Search academic papers",
|
|
2441
|
-
description: `Search for academic publications across multiple databases with relevance ranking. Costs ${academicCreditCosts.academicSearch} credits per request.`,
|
|
2488
|
+
description: `Search for academic publications across multiple databases with relevance ranking. Costs ${academicCreditCosts.academicSearch} credits per request, also when no papers match. If every provider fails, it returns HTTP 503 and charges nothing.`,
|
|
2442
2489
|
tags: ["Academic"],
|
|
2443
2490
|
spec: (op) => {
|
|
2444
2491
|
op.security = [{ bearerAuth: [] }];
|
|
2445
2492
|
const reqBody = op.requestBody;
|
|
2446
|
-
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$
|
|
2493
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$18;
|
|
2447
2494
|
op["x-codeSamples"] = getOpenApiCodeSamples("academic-search");
|
|
2448
2495
|
return op;
|
|
2449
2496
|
}
|
|
@@ -2477,7 +2524,7 @@ const providerErrorSchema = zod.z.object({
|
|
|
2477
2524
|
code: zod.z.string().nullish(),
|
|
2478
2525
|
details: zod.z.record(zod.z.string(), zod.z.unknown()).nullish()
|
|
2479
2526
|
});
|
|
2480
|
-
const requestExamples$
|
|
2527
|
+
const requestExamples$17 = {
|
|
2481
2528
|
"Search all providers": {
|
|
2482
2529
|
summary: "Search grants across all funding databases",
|
|
2483
2530
|
value: { query: "machine learning healthcare" }
|
|
@@ -2555,7 +2602,7 @@ const searchGrants = oc.input(zod.z.object({
|
|
|
2555
2602
|
spec: (op) => {
|
|
2556
2603
|
op.security = [{ bearerAuth: [] }];
|
|
2557
2604
|
const reqBody = op.requestBody;
|
|
2558
|
-
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$
|
|
2605
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$17;
|
|
2559
2606
|
op["x-codeSamples"] = getOpenApiCodeSamples("academic-search-grants");
|
|
2560
2607
|
return op;
|
|
2561
2608
|
}
|
|
@@ -2588,7 +2635,7 @@ const similarPaperSchema = zod.z.object({
|
|
|
2588
2635
|
citingIds: zod.z.array(zod.z.string()).nullish().describe("OpenAlex IDs of papers in result set that cite this paper (only if includeEdges=true)"),
|
|
2589
2636
|
citedByIds: zod.z.array(zod.z.string()).nullish().describe("OpenAlex IDs of papers in result set cited by this paper (only if includeEdges=true)")
|
|
2590
2637
|
});
|
|
2591
|
-
const requestExamples$
|
|
2638
|
+
const requestExamples$16 = {
|
|
2592
2639
|
"Find similar papers by DOI": {
|
|
2593
2640
|
summary: "Find papers similar to a given paper",
|
|
2594
2641
|
value: {
|
|
@@ -2646,7 +2693,7 @@ const similarPapers = oc.input(zod.z.object({
|
|
|
2646
2693
|
spec: (op) => {
|
|
2647
2694
|
op.security = [{ bearerAuth: [] }];
|
|
2648
2695
|
const reqBody = op.requestBody;
|
|
2649
|
-
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$
|
|
2696
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$16;
|
|
2650
2697
|
op["x-codeSamples"] = getOpenApiCodeSamples("academic-similar-papers");
|
|
2651
2698
|
return op;
|
|
2652
2699
|
}
|
|
@@ -3006,8 +3053,8 @@ var admin_exports = /* @__PURE__ */ __exportAll({
|
|
|
3006
3053
|
setVersion: () => setVersion
|
|
3007
3054
|
});
|
|
3008
3055
|
// ../util/lib/contract/instance/router/authenticate/validate-credential.ts
|
|
3009
|
-
const inputSchema$
|
|
3010
|
-
const outputSchema$
|
|
3056
|
+
const inputSchema$4 = zod.z.object({}).optional();
|
|
3057
|
+
const outputSchema$5 = zod.z.object({
|
|
3011
3058
|
status: zod.z.string().describe("Server status indicator"),
|
|
3012
3059
|
version: zod.z.string().describe("Server version"),
|
|
3013
3060
|
timestamp: zod.z.string().describe("Current server timestamp in ISO 8601 format")
|
|
@@ -3020,7 +3067,7 @@ const validateCredential = oc.route({
|
|
|
3020
3067
|
op.security = [{ bearerAuth: [] }];
|
|
3021
3068
|
return op;
|
|
3022
3069
|
}
|
|
3023
|
-
}).input(inputSchema$
|
|
3070
|
+
}).input(inputSchema$4).output(outputSchema$5);
|
|
3024
3071
|
// ../util/lib/contract/instance/router/authenticate/index.ts
|
|
3025
3072
|
var authenticate_exports = /* @__PURE__ */ __exportAll({ validateCredential: () => validateCredential });
|
|
3026
3073
|
// ../util/lib/contract/instance/router/bankStatement/get-default-spec.ts
|
|
@@ -3064,7 +3111,7 @@ const askOutputSchema$3 = zod.z.object({
|
|
|
3064
3111
|
requestId: zod.z.number().int().describe("Unique request identifier for this API call"),
|
|
3065
3112
|
documentId: zod.z.string().optional().describe("Document ID if provided via x-pdfvector-document-id header or request body")
|
|
3066
3113
|
});
|
|
3067
|
-
const requestExamples$
|
|
3114
|
+
const requestExamples$15 = { "Ask from URL": {
|
|
3068
3115
|
summary: "Ask from URL",
|
|
3069
3116
|
value: {
|
|
3070
3117
|
url: "https://example.com/bank-statement.pdf",
|
|
@@ -3076,7 +3123,7 @@ const ask$3 = oc.route({
|
|
|
3076
3123
|
description: `Parse a bank statement and answer a question about its content using AI. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string.`,
|
|
3077
3124
|
tags: ["Bank Statement"],
|
|
3078
3125
|
spec: (op) => {
|
|
3079
|
-
const spec = getDefaultSpec$3(op, requestExamples$
|
|
3126
|
+
const spec = getDefaultSpec$3(op, requestExamples$15);
|
|
3080
3127
|
spec["x-codeSamples"] = getOpenApiCodeSamples("bank-statement-ask");
|
|
3081
3128
|
return spec;
|
|
3082
3129
|
}
|
|
@@ -3118,7 +3165,7 @@ const extractOutputSchema$3 = zod.z.object({
|
|
|
3118
3165
|
requestId: zod.z.number().int().describe("Unique request identifier for this API call"),
|
|
3119
3166
|
documentId: zod.z.string().optional().describe("Document ID if provided via x-pdfvector-document-id header or request body")
|
|
3120
3167
|
});
|
|
3121
|
-
const requestExamples$
|
|
3168
|
+
const requestExamples$14 = { "Extract from URL": {
|
|
3122
3169
|
summary: "Extract from URL",
|
|
3123
3170
|
value: {
|
|
3124
3171
|
url: "https://example.com/bank-statement.pdf",
|
|
@@ -3149,7 +3196,7 @@ const extract$3 = oc.route({
|
|
|
3149
3196
|
description: `Parse a bank statement 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.`,
|
|
3150
3197
|
tags: ["Bank Statement"],
|
|
3151
3198
|
spec: (op) => {
|
|
3152
|
-
const spec = getDefaultSpec$3(op, requestExamples$
|
|
3199
|
+
const spec = getDefaultSpec$3(op, requestExamples$14);
|
|
3153
3200
|
spec["x-codeSamples"] = getOpenApiCodeSamples("bank-statement-extract");
|
|
3154
3201
|
return spec;
|
|
3155
3202
|
}
|
|
@@ -3180,7 +3227,7 @@ const parseOutputSchema$3 = zod.z.object({
|
|
|
3180
3227
|
html: zod.z.string().optional().describe("Full HTML representation of the document content. Only available when using the 'max' model. Preserves rich formatting, tables, selection marks, and visual layout that cannot be fully represented in markdown."),
|
|
3181
3228
|
documentId: zod.z.string().optional().describe("Document ID if provided via x-pdfvector-document-id header or request body")
|
|
3182
3229
|
});
|
|
3183
|
-
const requestExamples$
|
|
3230
|
+
const requestExamples$13 = {
|
|
3184
3231
|
"Parse from URL": {
|
|
3185
3232
|
summary: "Parse from URL",
|
|
3186
3233
|
value: { url: "https://example.com/bank-statement.pdf" }
|
|
@@ -3199,7 +3246,7 @@ const parse$3 = oc.route({
|
|
|
3199
3246
|
description: `Extract text and structured data from a bank statement. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string.`,
|
|
3200
3247
|
tags: ["Bank Statement"],
|
|
3201
3248
|
spec: (op) => {
|
|
3202
|
-
const spec = getDefaultSpec$3(op, requestExamples$
|
|
3249
|
+
const spec = getDefaultSpec$3(op, requestExamples$13);
|
|
3203
3250
|
spec["x-codeSamples"] = getOpenApiCodeSamples("bank-statement-parse");
|
|
3204
3251
|
return spec;
|
|
3205
3252
|
}
|
|
@@ -3256,7 +3303,7 @@ const askOutputSchema$2 = zod.z.object({
|
|
|
3256
3303
|
credits: 48,
|
|
3257
3304
|
requestId: 1
|
|
3258
3305
|
}] });
|
|
3259
|
-
const requestExamples$
|
|
3306
|
+
const requestExamples$12 = {
|
|
3260
3307
|
"Ask from URL": {
|
|
3261
3308
|
summary: "Ask from URL",
|
|
3262
3309
|
value: {
|
|
@@ -3297,10 +3344,10 @@ const requestExamples$11 = {
|
|
|
3297
3344
|
};
|
|
3298
3345
|
const ask$2 = oc.route({
|
|
3299
3346
|
summary: "Ask a question about a document",
|
|
3300
|
-
description: `Parse a document and answer a question about its content using AI. Supports ${supportedFileTypesLong}.
|
|
3347
|
+
description: `Parse a document and answer a question about its content using AI. Supports ${supportedFileTypesLong}. ${fileLimitsDescription} ${suggestedModelDescription} Provide the document via file upload, a public URL, or a base64-encoded string.`,
|
|
3301
3348
|
tags: ["Document"],
|
|
3302
3349
|
spec: (op) => {
|
|
3303
|
-
const spec = getDefaultSpec$2(op, requestExamples$
|
|
3350
|
+
const spec = getDefaultSpec$2(op, requestExamples$12);
|
|
3304
3351
|
spec["x-codeSamples"] = getOpenApiCodeSamples("document-ask");
|
|
3305
3352
|
return spec;
|
|
3306
3353
|
}
|
|
@@ -3337,7 +3384,7 @@ const extractOutputSchema$2 = zod.z.object({
|
|
|
3337
3384
|
credits: 48,
|
|
3338
3385
|
requestId: 1
|
|
3339
3386
|
}] });
|
|
3340
|
-
const requestExamples$
|
|
3387
|
+
const requestExamples$11 = {
|
|
3341
3388
|
"Extract from URL": {
|
|
3342
3389
|
summary: "Extract from URL",
|
|
3343
3390
|
value: {
|
|
@@ -3391,10 +3438,10 @@ const requestExamples$10 = {
|
|
|
3391
3438
|
};
|
|
3392
3439
|
const extract$2 = oc.route({
|
|
3393
3440
|
summary: "Extract structured data from a document",
|
|
3394
|
-
description: `Parse a document and extract structured data matching a provided JSON Schema using AI. Supports ${supportedFileTypesLong}.
|
|
3441
|
+
description: `Parse a document and extract structured data matching a provided JSON Schema using AI. Supports ${supportedFileTypesLong}. ${fileLimitsDescription} ${suggestedModelDescription} Provide the document via file upload, a public URL, or a base64-encoded string.`,
|
|
3395
3442
|
tags: ["Document"],
|
|
3396
3443
|
spec: (op) => {
|
|
3397
|
-
const spec = getDefaultSpec$2(op, requestExamples$
|
|
3444
|
+
const spec = getDefaultSpec$2(op, requestExamples$11);
|
|
3398
3445
|
spec["x-codeSamples"] = getOpenApiCodeSamples("document-extract");
|
|
3399
3446
|
return spec;
|
|
3400
3447
|
}
|
|
@@ -3447,7 +3494,7 @@ const parseOutputSchema$2 = zod.z.object({
|
|
|
3447
3494
|
documentId: zod.z.string().optional().describe("Document ID if provided via x-pdfvector-document-id header or request body"),
|
|
3448
3495
|
pages: zod.z.array(pageMarkdownSchema).optional().describe("Page-separated markdown content. Returned only when includePages is true.")
|
|
3449
3496
|
});
|
|
3450
|
-
const requestExamples$
|
|
3497
|
+
const requestExamples$10 = {
|
|
3451
3498
|
"Parse from URL": {
|
|
3452
3499
|
summary: "Parse from URL",
|
|
3453
3500
|
value: { url: "https://drive.google.com/file/d/13T04Yk20OwBNIDyvJJ3XlUg9WfOsmbjm/view?usp=share_link" }
|
|
@@ -3491,10 +3538,10 @@ const requestExamples$9 = {
|
|
|
3491
3538
|
};
|
|
3492
3539
|
const parse$2 = oc.route({
|
|
3493
3540
|
summary: "Parse a document",
|
|
3494
|
-
description: `Extract text and page count from a document. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string
|
|
3541
|
+
description: `Extract text and page count from a document. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string. ${suggestedModelDescription}`,
|
|
3495
3542
|
tags: ["Document"],
|
|
3496
3543
|
spec: (op) => {
|
|
3497
|
-
const spec = getDefaultSpec$2(op, requestExamples$
|
|
3544
|
+
const spec = getDefaultSpec$2(op, requestExamples$10);
|
|
3498
3545
|
spec["x-codeSamples"] = documentParseOpenApiCodeSamples;
|
|
3499
3546
|
return spec;
|
|
3500
3547
|
}
|
|
@@ -3506,19 +3553,21 @@ var document_exports = /* @__PURE__ */ __exportAll({
|
|
|
3506
3553
|
parse: () => parse$2
|
|
3507
3554
|
});
|
|
3508
3555
|
// ../util/lib/contract/instance/router/free/bank-statement-parse.ts
|
|
3509
|
-
const
|
|
3556
|
+
const MB$1 = 1048576;
|
|
3557
|
+
const limits$1 = freeTierLimits.bankStatementParse;
|
|
3558
|
+
const inputSchema$3 = zod.z.object({
|
|
3510
3559
|
url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
|
|
3511
3560
|
file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
|
|
3512
3561
|
base64: zod.z.string().optional().describe("Base64-encoded bank statement file content")
|
|
3513
3562
|
});
|
|
3514
|
-
const outputSchema$
|
|
3563
|
+
const outputSchema$4 = zod.z.object({
|
|
3515
3564
|
markdown: zod.z.string().describe("Extracted text content from the bank statement"),
|
|
3516
3565
|
pageCount: zod.z.number().int().describe("Total number of pages in the document"),
|
|
3517
3566
|
model: zod.z.enum(["pro", "max"]).describe("Model tier used to parse the bank statement"),
|
|
3518
3567
|
requestId: zod.z.number().int().describe("Unique request identifier for this API call"),
|
|
3519
3568
|
html: zod.z.string().optional().describe("Full HTML representation of the document content")
|
|
3520
3569
|
});
|
|
3521
|
-
const requestExamples$
|
|
3570
|
+
const requestExamples$9 = {
|
|
3522
3571
|
"Parse from URL": {
|
|
3523
3572
|
summary: "Parse from URL",
|
|
3524
3573
|
value: { url: "https://raw.githubusercontent.com/aws-samples/textract-bank-statement-processor/main/Statement20230428.pdf" }
|
|
@@ -3532,7 +3581,7 @@ const requestExamples$8 = {
|
|
|
3532
3581
|
value: { file: "(binary)" }
|
|
3533
3582
|
}
|
|
3534
3583
|
};
|
|
3535
|
-
const responseExample$
|
|
3584
|
+
const responseExample$4 = {
|
|
3536
3585
|
markdown: "## Bank Statement\n\n### Account Information\n\n| Field | Value |\n|-------|-------|\n| Bank Name | Example Bank |\n| Account Number | ****1234 |\n| Statement Start Date | 2023-03-01 |\n| Statement End Date | 2023-03-31 |\n| Beginning Balance | $5,432.10 |\n| Ending Balance | $4,891.55 |\n\n### Transactions\n\n| Date | Description | Deposit Amount | Withdrawal Amount |\n| --- | --- | --- | --- |\n| 2023-03-05 | Direct Deposit - Payroll | $3,200.00 | |\n| 2023-03-08 | Online Transfer Out | | $500.00 |\n| 2023-03-15 | Grocery Store | | $142.35 |",
|
|
3537
3586
|
pageCount: 2,
|
|
3538
3587
|
model: "max",
|
|
@@ -3541,7 +3590,60 @@ const responseExample$3 = {
|
|
|
3541
3590
|
};
|
|
3542
3591
|
const bankStatementParse = oc.route({
|
|
3543
3592
|
summary: "Free: Parse a bank statement",
|
|
3544
|
-
description: `Extract text and structured data from a bank statement. Supports ${supportedFileTypesLong}. Free tier: max
|
|
3593
|
+
description: `Extract text and structured data from a bank statement. Supports ${supportedFileTypesLong}. Free tier: max ${limits$1.maxPages} pages, max ${limits$1.maxFileSize / MB$1} MB. Rate limited to ${limits$1.dailyLimit} requests per IP per day. Requires a Cloudflare Turnstile token from www.pdfvector.com in the x-pdfvector-turnstile-token header (MCP calls are exempt).`,
|
|
3594
|
+
tags: ["Free"],
|
|
3595
|
+
spec: (op) => {
|
|
3596
|
+
op.security = [];
|
|
3597
|
+
const reqBody = op.requestBody;
|
|
3598
|
+
if (reqBody?.content) for (const mediaType of Object.values(reqBody.content)) mediaType["examples"] = requestExamples$9;
|
|
3599
|
+
const okResponse = op.responses?.["200"];
|
|
3600
|
+
if (okResponse?.content) for (const mediaType of Object.values(okResponse.content)) mediaType["example"] = responseExample$4;
|
|
3601
|
+
return op;
|
|
3602
|
+
}
|
|
3603
|
+
}).input(inputSchema$3).output(outputSchema$4);
|
|
3604
|
+
// ../util/lib/contract/instance/router/free/document-parse.ts
|
|
3605
|
+
const MB = 1048576;
|
|
3606
|
+
const limits = freeTierLimits.documentParse;
|
|
3607
|
+
const inputSchema$2 = zod.z.object({
|
|
3608
|
+
url: fetchableUrlSchema.optional().describe("URL of the document to fetch and parse"),
|
|
3609
|
+
file: zod.z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
|
|
3610
|
+
base64: zod.z.string().optional().describe("Base64-encoded document content")
|
|
3611
|
+
});
|
|
3612
|
+
const outputSchema$3 = zod.z.object({
|
|
3613
|
+
markdown: zod.z.string().describe("Markdown content of the document"),
|
|
3614
|
+
pageCount: zod.z.number().int().describe("Total number of pages in the document"),
|
|
3615
|
+
model: zod.z.enum([
|
|
3616
|
+
"nano",
|
|
3617
|
+
"mini",
|
|
3618
|
+
"pro",
|
|
3619
|
+
"max"
|
|
3620
|
+
]).describe("Model tier the auto model selected for the document"),
|
|
3621
|
+
requestId: zod.z.number().int().describe("Unique request identifier for this API call"),
|
|
3622
|
+
html: zod.z.string().optional().describe("Full HTML representation of the document content")
|
|
3623
|
+
});
|
|
3624
|
+
const requestExamples$8 = {
|
|
3625
|
+
"Parse from URL": {
|
|
3626
|
+
summary: "Parse from URL",
|
|
3627
|
+
value: { url: "https://pdfobject.com/pdf/sample.pdf" }
|
|
3628
|
+
},
|
|
3629
|
+
"Parse from base64": {
|
|
3630
|
+
summary: "Parse from base64",
|
|
3631
|
+
value: { base64: "JVBERi0xLjAKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqIDIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iaiAzIDAgb2JqPDwvVHlwZS9QYWdlL01lZGlhQm94WzAgMCAzIDNdL1BhcmVudCAyIDAgUj4+ZW5kb2JqCnhyZWYKMCA0CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKdHJhaWxlcjw8L1NpemUgNC9Sb290IDEgMCBSPj4Kc3RhcnR4cmVmCjE5MAolJUVPRg==" }
|
|
3632
|
+
},
|
|
3633
|
+
"Parse from file upload": {
|
|
3634
|
+
summary: "Parse from file upload",
|
|
3635
|
+
value: { file: "(binary)" }
|
|
3636
|
+
}
|
|
3637
|
+
};
|
|
3638
|
+
const responseExample$3 = {
|
|
3639
|
+
markdown: "# Sample PDF\n\n## This is a simple PDF file. Fun fun fun.\n\nLorem ipsum dolor sit amet...",
|
|
3640
|
+
pageCount: 1,
|
|
3641
|
+
model: "mini",
|
|
3642
|
+
requestId: 42
|
|
3643
|
+
};
|
|
3644
|
+
const documentParse = oc.route({
|
|
3645
|
+
summary: "Free: Convert a document to markdown",
|
|
3646
|
+
description: `Convert a document to markdown. Supports ${supportedFileTypesLong}. Files the local engines read (Office, OpenDocument, RTF, EPUB, HTML, text and PDFs with a text layer) are converted without OCR; scanned PDFs and images use OCR. Free tier: max ${limits.maxPages} pages (${limits.maxOcrPages} for scans and images), max ${limits.maxFileSize / MB} MB. Rate limited to ${limits.dailyLimit} requests per IP per day. Requires a Cloudflare Turnstile token from www.pdfvector.com in the x-pdfvector-turnstile-token header (MCP calls are exempt).`,
|
|
3545
3647
|
tags: ["Free"],
|
|
3546
3648
|
spec: (op) => {
|
|
3547
3649
|
op.security = [];
|
|
@@ -3634,7 +3736,7 @@ const responseExample$2 = {
|
|
|
3634
3736
|
};
|
|
3635
3737
|
const generateSchema = oc.route({
|
|
3636
3738
|
summary: "Free: Generate a JSON Schema",
|
|
3637
|
-
description:
|
|
3739
|
+
description: `Generate a JSON Schema from a natural language instruction. Use the resulting schema with the /extract endpoints to pull structured data from documents. Rate limited to ${freeTierLimits.generateSchema.dailyLimit} requests per IP per day. Requires a Cloudflare Turnstile token from www.pdfvector.com in the x-pdfvector-turnstile-token header (MCP calls are exempt).`,
|
|
3638
3740
|
tags: ["Free"],
|
|
3639
3741
|
spec: (op) => {
|
|
3640
3742
|
op.security = [];
|
|
@@ -3688,7 +3790,7 @@ const responseExample$1 = {
|
|
|
3688
3790
|
};
|
|
3689
3791
|
const publicationPdfUrl = oc.route({
|
|
3690
3792
|
summary: "Free: Get publication PDF URL",
|
|
3691
|
-
description:
|
|
3793
|
+
description: `Look up publications by DOI, PubMed ID, ArXiv ID, or other identifiers and return their PDF URLs if available. Accepts up to 20 IDs per request. Rate limited to ${freeTierLimits.publicationPdfUrl.dailyLimit} requests per IP per day. Requires a Cloudflare Turnstile token from www.pdfvector.com in the x-pdfvector-turnstile-token header (MCP calls are exempt).`,
|
|
3692
3794
|
tags: ["Free"],
|
|
3693
3795
|
spec: (op) => {
|
|
3694
3796
|
op.security = [];
|
|
@@ -3707,6 +3809,7 @@ const limitSchema = zod.z.object({
|
|
|
3707
3809
|
});
|
|
3708
3810
|
const outputSchema = zod.z.object({
|
|
3709
3811
|
bankStatementParse: limitSchema.describe("Bank statement parse limits"),
|
|
3812
|
+
documentParse: limitSchema.describe("Document parse limits"),
|
|
3710
3813
|
generateSchema: limitSchema.describe("JSON schema generator limits"),
|
|
3711
3814
|
publicationPdfUrl: limitSchema.describe("Publication PDF URL lookup limits")
|
|
3712
3815
|
});
|
|
@@ -3716,6 +3819,11 @@ const responseExample = {
|
|
|
3716
3819
|
used: 2,
|
|
3717
3820
|
remaining: 3
|
|
3718
3821
|
},
|
|
3822
|
+
documentParse: {
|
|
3823
|
+
limit: 5,
|
|
3824
|
+
used: 1,
|
|
3825
|
+
remaining: 4
|
|
3826
|
+
},
|
|
3719
3827
|
generateSchema: {
|
|
3720
3828
|
limit: 10,
|
|
3721
3829
|
used: 0,
|
|
@@ -3742,6 +3850,7 @@ const rateLimitStatus = oc.route({
|
|
|
3742
3850
|
// ../util/lib/contract/instance/router/free/index.ts
|
|
3743
3851
|
var free_exports = /* @__PURE__ */ __exportAll({
|
|
3744
3852
|
bankStatementParse: () => bankStatementParse,
|
|
3853
|
+
documentParse: () => documentParse,
|
|
3745
3854
|
generateSchema: () => generateSchema,
|
|
3746
3855
|
publicationPdfUrl: () => publicationPdfUrl,
|
|
3747
3856
|
rateLimitStatus: () => rateLimitStatus
|