@pdfvector/util 0.0.32 → 0.1.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/.tsc/lib/api-docs.d.ts +50 -0
- package/.tsc/lib/api-docs.d.ts.map +1 -0
- package/.tsc/lib/api-docs.js +1803 -0
- package/.tsc/lib/api-source.d.ts +1 -1
- package/.tsc/lib/api-source.d.ts.map +1 -1
- package/.tsc/lib/api-source.js +1 -0
- package/.tsc/lib/contract/gateway/index.d.ts +1 -0
- package/.tsc/lib/contract/gateway/index.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/index.js +1 -0
- package/.tsc/lib/contract/gateway/mcp-account.d.ts +64 -0
- package/.tsc/lib/contract/gateway/mcp-account.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/mcp-account.js +38 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts +10 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/admin/usage/free.js +2 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts +2 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/instance/usage.d.ts +4 -0
- package/.tsc/lib/contract/gateway/router/instance/usage.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/fetch.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/fetch.js +1 -1
- package/.tsc/lib/contract/instance/router/academic/find-citations.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/find-citations.js +1 -1
- package/.tsc/lib/contract/instance/router/academic/paper-graph.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/paper-graph.js +1 -1
- package/.tsc/lib/contract/instance/router/academic/parse.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/parse.js +1 -1
- package/.tsc/lib/contract/instance/router/academic/search-grants.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/search-grants.js +1 -1
- package/.tsc/lib/contract/instance/router/academic/search.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/search.js +1 -1
- package/.tsc/lib/contract/instance/router/academic/similar-papers.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/academic/similar-papers.js +1 -1
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.d.ts +10 -0
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.js +2 -1
- package/.tsc/lib/contract/instance/router/admin/get-usage-records.d.ts +1 -0
- package/.tsc/lib/contract/instance/router/admin/get-usage-records.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/bankStatement/ask.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/bankStatement/ask.js +1 -1
- package/.tsc/lib/contract/instance/router/bankStatement/extract.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/bankStatement/extract.js +1 -1
- package/.tsc/lib/contract/instance/router/bankStatement/parse.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/bankStatement/parse.js +1 -1
- package/.tsc/lib/contract/instance/router/document/ask.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/document/ask.js +1 -1
- package/.tsc/lib/contract/instance/router/document/extract.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/document/extract.js +1 -1
- package/.tsc/lib/contract/instance/router/document/parse.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/document/parse.js +1 -1
- package/.tsc/lib/contract/instance/router/identity/ask.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/identity/ask.js +1 -1
- package/.tsc/lib/contract/instance/router/identity/extract.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/identity/extract.js +1 -1
- package/.tsc/lib/contract/instance/router/identity/parse.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/identity/parse.js +1 -1
- package/.tsc/lib/contract/instance/router/invoice/ask.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/invoice/ask.js +1 -1
- package/.tsc/lib/contract/instance/router/invoice/extract.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/invoice/extract.js +1 -1
- package/.tsc/lib/contract/instance/router/invoice/parse.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/invoice/parse.js +1 -1
- package/CHANGELOG.md +12 -0
- package/package.json +9 -6
|
@@ -0,0 +1,1803 @@
|
|
|
1
|
+
export const pricingPlans = [
|
|
2
|
+
{
|
|
3
|
+
name: "Free",
|
|
4
|
+
monthlyPrice: 0,
|
|
5
|
+
annualMonthlyPrice: 0,
|
|
6
|
+
description: "Try all APIs with 100 credits. No credit card required.",
|
|
7
|
+
credits: 100,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "Basic",
|
|
11
|
+
monthlyPrice: 25,
|
|
12
|
+
annualMonthlyPrice: 23,
|
|
13
|
+
description: "For growing teams that need reliable document processing.",
|
|
14
|
+
credits: 3000,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "Pro",
|
|
18
|
+
monthlyPrice: 97,
|
|
19
|
+
annualMonthlyPrice: 89,
|
|
20
|
+
description: "For teams with high-volume document processing needs.",
|
|
21
|
+
credits: 100000,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "Enterprise",
|
|
25
|
+
monthlyPrice: 0,
|
|
26
|
+
annualMonthlyPrice: 0,
|
|
27
|
+
description: "Dedicated instances with custom SLAs for your team.",
|
|
28
|
+
credits: 0,
|
|
29
|
+
isEnterprise: true,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
export const creditTable = [
|
|
33
|
+
{
|
|
34
|
+
api: "Document Parse",
|
|
35
|
+
nano: 1,
|
|
36
|
+
mini: 2,
|
|
37
|
+
pro: 4,
|
|
38
|
+
max: 8,
|
|
39
|
+
unit: "/page",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
api: "Document Ask",
|
|
43
|
+
nano: 2,
|
|
44
|
+
mini: 4,
|
|
45
|
+
pro: 8,
|
|
46
|
+
max: 16,
|
|
47
|
+
unit: "/page",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
api: "Document Extract",
|
|
51
|
+
nano: 2,
|
|
52
|
+
mini: 4,
|
|
53
|
+
pro: 8,
|
|
54
|
+
max: 16,
|
|
55
|
+
unit: "/page",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
api: "Identity Parse",
|
|
59
|
+
nano: "-",
|
|
60
|
+
mini: "-",
|
|
61
|
+
pro: 6,
|
|
62
|
+
max: 10,
|
|
63
|
+
unit: "/page",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
api: "Identity Ask",
|
|
67
|
+
nano: 6,
|
|
68
|
+
mini: 10,
|
|
69
|
+
pro: 14,
|
|
70
|
+
max: 18,
|
|
71
|
+
unit: "/page",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
api: "Identity Extract",
|
|
75
|
+
nano: 6,
|
|
76
|
+
mini: 10,
|
|
77
|
+
pro: 14,
|
|
78
|
+
max: 18,
|
|
79
|
+
unit: "/page",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
api: "Invoice Parse",
|
|
83
|
+
nano: "-",
|
|
84
|
+
mini: "-",
|
|
85
|
+
pro: 6,
|
|
86
|
+
max: 10,
|
|
87
|
+
unit: "/page",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
api: "Invoice Ask",
|
|
91
|
+
nano: 6,
|
|
92
|
+
mini: 10,
|
|
93
|
+
pro: 14,
|
|
94
|
+
max: 18,
|
|
95
|
+
unit: "/page",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
api: "Invoice Extract",
|
|
99
|
+
nano: 6,
|
|
100
|
+
mini: 10,
|
|
101
|
+
pro: 14,
|
|
102
|
+
max: 18,
|
|
103
|
+
unit: "/page",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
api: "Bank Statement Parse",
|
|
107
|
+
nano: "-",
|
|
108
|
+
mini: "-",
|
|
109
|
+
pro: 6,
|
|
110
|
+
max: 10,
|
|
111
|
+
unit: "/page",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
api: "Bank Statement Ask",
|
|
115
|
+
nano: 6,
|
|
116
|
+
mini: 10,
|
|
117
|
+
pro: 14,
|
|
118
|
+
max: 18,
|
|
119
|
+
unit: "/page",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
api: "Bank Statement Extract",
|
|
123
|
+
nano: 6,
|
|
124
|
+
mini: 10,
|
|
125
|
+
pro: 14,
|
|
126
|
+
max: 18,
|
|
127
|
+
unit: "/page",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
api: "Academic Search",
|
|
131
|
+
nano: 2,
|
|
132
|
+
mini: 2,
|
|
133
|
+
pro: 2,
|
|
134
|
+
max: 2,
|
|
135
|
+
unit: "/request",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
api: "Academic Fetch",
|
|
139
|
+
nano: 2,
|
|
140
|
+
mini: 2,
|
|
141
|
+
pro: 2,
|
|
142
|
+
max: 2,
|
|
143
|
+
unit: "/request",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
api: "Academic Parse",
|
|
147
|
+
nano: 1,
|
|
148
|
+
mini: 2,
|
|
149
|
+
pro: 4,
|
|
150
|
+
max: 8,
|
|
151
|
+
unit: "/page",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
api: "Academic Find Citations",
|
|
155
|
+
nano: 2,
|
|
156
|
+
mini: 2,
|
|
157
|
+
pro: 2,
|
|
158
|
+
max: 2,
|
|
159
|
+
unit: "/sentence",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
api: "Academic Paper Graph",
|
|
163
|
+
nano: "2+",
|
|
164
|
+
mini: "2+",
|
|
165
|
+
pro: "2+",
|
|
166
|
+
max: "2+",
|
|
167
|
+
unit: "/request",
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
api: "Academic Similar Papers",
|
|
171
|
+
nano: 3,
|
|
172
|
+
mini: 3,
|
|
173
|
+
pro: 3,
|
|
174
|
+
max: 3,
|
|
175
|
+
unit: "/request",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
api: "Academic Search Grants",
|
|
179
|
+
nano: 2,
|
|
180
|
+
mini: 2,
|
|
181
|
+
pro: 2,
|
|
182
|
+
max: 2,
|
|
183
|
+
unit: "/request",
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
const globalBaseUrl = "https://global.pdfvector.com";
|
|
187
|
+
const documentUrl = "https://example.com/annual-report.pdf";
|
|
188
|
+
const overviewDocumentUrl = "https://example.com/document.pdf";
|
|
189
|
+
const documentId = "my-doc-123";
|
|
190
|
+
const arxivId = "1706.03762";
|
|
191
|
+
function buildDocumentParseCurl(baseUrl = globalBaseUrl) {
|
|
192
|
+
return `curl -X POST ${baseUrl}/api/document/parse \\
|
|
193
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
194
|
+
-H "Content-Type: application/json" \\
|
|
195
|
+
-H "x-pdfvector-document-id: ${documentId}" \\
|
|
196
|
+
-d '{
|
|
197
|
+
"url": "${documentUrl}",
|
|
198
|
+
"model": "max",
|
|
199
|
+
"includePages": true
|
|
200
|
+
}'`;
|
|
201
|
+
}
|
|
202
|
+
function buildDocumentParseTypeScript() {
|
|
203
|
+
return `import { createClient } from "@pdfvector/client";
|
|
204
|
+
|
|
205
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
206
|
+
|
|
207
|
+
const result = await client.document.parse(
|
|
208
|
+
{ url: "${documentUrl}", model: "max", includePages: true },
|
|
209
|
+
{ context: { documentId: "${documentId}" } },
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
console.log(result.markdown);
|
|
213
|
+
console.log(result.pages?.[0]?.markdown);
|
|
214
|
+
console.log(\`Pages: \${result.pageCount}, Model: \${result.model}\`);`;
|
|
215
|
+
}
|
|
216
|
+
function buildDocumentParsePython(baseUrl = globalBaseUrl) {
|
|
217
|
+
return `import requests
|
|
218
|
+
|
|
219
|
+
response = requests.post(
|
|
220
|
+
"${baseUrl}/api/document/parse",
|
|
221
|
+
headers={
|
|
222
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
223
|
+
"x-pdfvector-document-id": "${documentId}",
|
|
224
|
+
},
|
|
225
|
+
json={
|
|
226
|
+
"url": "${documentUrl}",
|
|
227
|
+
"model": "max",
|
|
228
|
+
"includePages": True,
|
|
229
|
+
},
|
|
230
|
+
)
|
|
231
|
+
data = response.json()
|
|
232
|
+
print(data["markdown"], data["pages"][0]["markdown"], data["pageCount"])`;
|
|
233
|
+
}
|
|
234
|
+
function buildAcademicParseCurl(baseUrl = globalBaseUrl) {
|
|
235
|
+
return `curl -X POST ${baseUrl}/api/academic/parse \\
|
|
236
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
237
|
+
-H "Content-Type: application/json" \\
|
|
238
|
+
-d '{
|
|
239
|
+
"id": "${arxivId}",
|
|
240
|
+
"model": "auto",
|
|
241
|
+
"includePages": true
|
|
242
|
+
}'`;
|
|
243
|
+
}
|
|
244
|
+
function buildAcademicParseTypeScript() {
|
|
245
|
+
return `import { createClient } from "@pdfvector/client";
|
|
246
|
+
|
|
247
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
248
|
+
|
|
249
|
+
const result = await client.academic.parse({
|
|
250
|
+
id: "${arxivId}",
|
|
251
|
+
model: "auto",
|
|
252
|
+
includePages: true,
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
console.log(result.title);
|
|
256
|
+
console.log(result.pdfURL);
|
|
257
|
+
console.log(result.markdown);
|
|
258
|
+
console.log(result.pages?.[0]?.markdown);`;
|
|
259
|
+
}
|
|
260
|
+
function buildAcademicParsePython(baseUrl = globalBaseUrl) {
|
|
261
|
+
return `import requests
|
|
262
|
+
|
|
263
|
+
response = requests.post(
|
|
264
|
+
"${baseUrl}/api/academic/parse",
|
|
265
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
266
|
+
json={
|
|
267
|
+
"url": "https://arxiv.org/abs/${arxivId}",
|
|
268
|
+
"model": "auto",
|
|
269
|
+
"includePages": True,
|
|
270
|
+
},
|
|
271
|
+
)
|
|
272
|
+
data = response.json()
|
|
273
|
+
print(data["title"])
|
|
274
|
+
print(data["markdown"])
|
|
275
|
+
print(data["pages"][0]["markdown"])`;
|
|
276
|
+
}
|
|
277
|
+
export const documentParseCodeExample = {
|
|
278
|
+
id: "document-parse",
|
|
279
|
+
label: "Parse",
|
|
280
|
+
group: "Document",
|
|
281
|
+
curl: buildDocumentParseCurl(),
|
|
282
|
+
typescript: buildDocumentParseTypeScript(),
|
|
283
|
+
python: buildDocumentParsePython(),
|
|
284
|
+
response: `{
|
|
285
|
+
"documentId": "${documentId}",
|
|
286
|
+
"markdown": "# Annual Report 2024\\n\\n## Executive Summary\\nRevenue grew 23% year-over-year to $4.2B...",
|
|
287
|
+
"pageCount": 5,
|
|
288
|
+
"pages": [{ "pageNumber": 1, "markdown": "# Annual Report 2024\\n\\n## Executive Summary..." }],
|
|
289
|
+
"model": "max",
|
|
290
|
+
"html": "<h1>Annual Report 2024</h1><h2>Executive Summary</h2><p>Revenue grew 23% year-over-year to $4.2B...</p>",
|
|
291
|
+
"credits": 40,
|
|
292
|
+
"requestId": 42
|
|
293
|
+
}`,
|
|
294
|
+
};
|
|
295
|
+
export const academicParseCodeExample = {
|
|
296
|
+
id: "academic-parse",
|
|
297
|
+
label: "Parse",
|
|
298
|
+
group: "Academic",
|
|
299
|
+
curl: buildAcademicParseCurl(),
|
|
300
|
+
typescript: buildAcademicParseTypeScript(),
|
|
301
|
+
python: buildAcademicParsePython(),
|
|
302
|
+
response: `{
|
|
303
|
+
"id": "${arxivId}",
|
|
304
|
+
"title": "Attention Is All You Need",
|
|
305
|
+
"doi": "10.48550/arXiv.${arxivId}",
|
|
306
|
+
"url": "https://global.pdfvector.com/publications/arxiv:${arxivId}",
|
|
307
|
+
"providerURL": "https://arxiv.org/abs/${arxivId}",
|
|
308
|
+
"pdfURL": "https://arxiv.org/pdf/${arxivId}",
|
|
309
|
+
"detectedProvider": "arxiv",
|
|
310
|
+
"markdown": "# Attention Is All You Need\\n\\nAshish Vaswani...",
|
|
311
|
+
"pageCount": 15,
|
|
312
|
+
"pages": [{ "pageNumber": 1, "markdown": "# Attention Is All You Need\\n\\nAshish Vaswani..." }],
|
|
313
|
+
"model": "auto",
|
|
314
|
+
"credits": 15,
|
|
315
|
+
"requestId": 47
|
|
316
|
+
}`,
|
|
317
|
+
};
|
|
318
|
+
export const publicApiCodeExamples = [
|
|
319
|
+
documentParseCodeExample,
|
|
320
|
+
{
|
|
321
|
+
id: "document-ask",
|
|
322
|
+
label: "Ask",
|
|
323
|
+
group: "Document",
|
|
324
|
+
curl: `curl -X POST https://global.pdfvector.com/api/document/ask \\
|
|
325
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
326
|
+
-H "Content-Type: application/json" \\
|
|
327
|
+
-H "x-pdfvector-document-id: my-doc-123" \\
|
|
328
|
+
-d '{
|
|
329
|
+
"url": "https://example.com/annual-report.pdf",
|
|
330
|
+
"question": "What was the total revenue in Q4?",
|
|
331
|
+
"model": "max"
|
|
332
|
+
}'`,
|
|
333
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
334
|
+
|
|
335
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
336
|
+
|
|
337
|
+
const result = await client.document.ask(
|
|
338
|
+
{
|
|
339
|
+
url: "https://example.com/annual-report.pdf",
|
|
340
|
+
question: "What was the total revenue in Q4?",
|
|
341
|
+
model: "max",
|
|
342
|
+
},
|
|
343
|
+
{ context: { documentId: "my-doc-123" } },
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
console.log(result.markdown);`,
|
|
347
|
+
python: `import requests
|
|
348
|
+
|
|
349
|
+
response = requests.post(
|
|
350
|
+
"https://global.pdfvector.com/api/document/ask",
|
|
351
|
+
headers={
|
|
352
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
353
|
+
"x-pdfvector-document-id": "my-doc-123",
|
|
354
|
+
},
|
|
355
|
+
json={
|
|
356
|
+
"url": "https://example.com/annual-report.pdf",
|
|
357
|
+
"question": "What was the total revenue in Q4?",
|
|
358
|
+
"model": "max",
|
|
359
|
+
},
|
|
360
|
+
)
|
|
361
|
+
data = response.json()
|
|
362
|
+
print(data["markdown"])`,
|
|
363
|
+
response: `{
|
|
364
|
+
"documentId": "my-doc-123",
|
|
365
|
+
"markdown": "Based on the document, the total revenue in Q4 was $1.12B, representing a 15% increase from Q3 and a 23% year-over-year growth.",
|
|
366
|
+
"model": "max",
|
|
367
|
+
"requestId": 43
|
|
368
|
+
}`,
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
id: "document-extract",
|
|
372
|
+
label: "Extract",
|
|
373
|
+
group: "Document",
|
|
374
|
+
curl: `curl -X POST https://global.pdfvector.com/api/document/extract \\
|
|
375
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
376
|
+
-H "Content-Type: application/json" \\
|
|
377
|
+
-H "x-pdfvector-document-id: my-doc-123" \\
|
|
378
|
+
-d '{
|
|
379
|
+
"url": "https://example.com/annual-report.pdf",
|
|
380
|
+
"prompt": "Extract the company overview, fiscal year, revenue, net income, and key business segments",
|
|
381
|
+
"schema": {
|
|
382
|
+
"type": "object",
|
|
383
|
+
"properties": {
|
|
384
|
+
"companyName": { "type": "string" },
|
|
385
|
+
"fiscalYear": { "type": "string" },
|
|
386
|
+
"totalRevenue": { "type": "number" },
|
|
387
|
+
"netIncome": { "type": "number" },
|
|
388
|
+
"segments": {
|
|
389
|
+
"type": "array",
|
|
390
|
+
"items": {
|
|
391
|
+
"type": "object",
|
|
392
|
+
"properties": {
|
|
393
|
+
"name": { "type": "string" },
|
|
394
|
+
"revenue": { "type": "number" },
|
|
395
|
+
"growthPercent": { "type": "number" }
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
"model": "max"
|
|
402
|
+
}'`,
|
|
403
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
404
|
+
|
|
405
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
406
|
+
|
|
407
|
+
const result = await client.document.extract(
|
|
408
|
+
{
|
|
409
|
+
url: "https://example.com/annual-report.pdf",
|
|
410
|
+
prompt: "Extract the company overview, fiscal year, revenue, net income, and key business segments",
|
|
411
|
+
schema: {
|
|
412
|
+
type: "object",
|
|
413
|
+
properties: {
|
|
414
|
+
companyName: { type: "string" },
|
|
415
|
+
fiscalYear: { type: "string" },
|
|
416
|
+
totalRevenue: { type: "number" },
|
|
417
|
+
netIncome: { type: "number" },
|
|
418
|
+
segments: {
|
|
419
|
+
type: "array",
|
|
420
|
+
items: {
|
|
421
|
+
type: "object",
|
|
422
|
+
properties: {
|
|
423
|
+
name: { type: "string" },
|
|
424
|
+
revenue: { type: "number" },
|
|
425
|
+
growthPercent: { type: "number" },
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
model: "max",
|
|
432
|
+
},
|
|
433
|
+
{ context: { documentId: "my-doc-123" } },
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
console.log(result.data);`,
|
|
437
|
+
python: `import requests
|
|
438
|
+
|
|
439
|
+
response = requests.post(
|
|
440
|
+
"https://global.pdfvector.com/api/document/extract",
|
|
441
|
+
headers={
|
|
442
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
443
|
+
"x-pdfvector-document-id": "my-doc-123",
|
|
444
|
+
},
|
|
445
|
+
json={
|
|
446
|
+
"url": "https://example.com/annual-report.pdf",
|
|
447
|
+
"prompt": "Extract the company overview, fiscal year, revenue, net income, and key business segments",
|
|
448
|
+
"schema": {
|
|
449
|
+
"type": "object",
|
|
450
|
+
"properties": {
|
|
451
|
+
"companyName": {"type": "string"},
|
|
452
|
+
"fiscalYear": {"type": "string"},
|
|
453
|
+
"totalRevenue": {"type": "number"},
|
|
454
|
+
"netIncome": {"type": "number"},
|
|
455
|
+
"segments": {
|
|
456
|
+
"type": "array",
|
|
457
|
+
"items": {
|
|
458
|
+
"type": "object",
|
|
459
|
+
"properties": {
|
|
460
|
+
"name": {"type": "string"},
|
|
461
|
+
"revenue": {"type": "number"},
|
|
462
|
+
"growthPercent": {"type": "number"},
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
"model": "max",
|
|
469
|
+
},
|
|
470
|
+
)
|
|
471
|
+
data = response.json()
|
|
472
|
+
print(data["data"])`,
|
|
473
|
+
response: `{
|
|
474
|
+
"documentId": "my-doc-123",
|
|
475
|
+
"data": {
|
|
476
|
+
"companyName": "Acme Corporation",
|
|
477
|
+
"fiscalYear": "2024",
|
|
478
|
+
"totalRevenue": 4200000000,
|
|
479
|
+
"netIncome": 820000000,
|
|
480
|
+
"segments": [
|
|
481
|
+
{ "name": "Cloud Services", "revenue": 2100000000, "growthPercent": 34 },
|
|
482
|
+
{ "name": "Enterprise Software", "revenue": 1400000000, "growthPercent": 18 },
|
|
483
|
+
{ "name": "Consulting", "revenue": 700000000, "growthPercent": 12 }
|
|
484
|
+
]
|
|
485
|
+
},
|
|
486
|
+
"model": "max",
|
|
487
|
+
"requestId": 44
|
|
488
|
+
}`,
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
id: "identity-parse",
|
|
492
|
+
label: "Parse",
|
|
493
|
+
group: "Identity",
|
|
494
|
+
curl: `curl -X POST https://global.pdfvector.com/api/identity/parse \\
|
|
495
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
496
|
+
-H "Content-Type: application/json" \\
|
|
497
|
+
-H "x-pdfvector-document-id: passport-456" \\
|
|
498
|
+
-d '{
|
|
499
|
+
"url": "https://example.com/passport-scan.jpg",
|
|
500
|
+
"model": "max"
|
|
501
|
+
}'`,
|
|
502
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
503
|
+
|
|
504
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
505
|
+
|
|
506
|
+
const result = await client.identity.parse(
|
|
507
|
+
{ url: "https://example.com/passport-scan.jpg", model: "max" },
|
|
508
|
+
{ context: { documentId: "passport-456" } },
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
console.log(result.markdown);
|
|
512
|
+
console.log(\`Type: \${result.documentType}, Model: \${result.model}\`);`,
|
|
513
|
+
python: `import requests
|
|
514
|
+
|
|
515
|
+
response = requests.post(
|
|
516
|
+
"https://global.pdfvector.com/api/identity/parse",
|
|
517
|
+
headers={
|
|
518
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
519
|
+
"x-pdfvector-document-id": "passport-456",
|
|
520
|
+
},
|
|
521
|
+
json={
|
|
522
|
+
"url": "https://example.com/passport-scan.jpg",
|
|
523
|
+
"model": "max",
|
|
524
|
+
},
|
|
525
|
+
)
|
|
526
|
+
data = response.json()
|
|
527
|
+
print(data["markdown"])`,
|
|
528
|
+
response: `{
|
|
529
|
+
"documentId": "passport-456",
|
|
530
|
+
"markdown": "# Passport — John A. Smith\\n\\n**Full Name:** John Alexander Smith\\n**Nationality:** United States\\n**Date of Birth:** 1985-03-15\\n**Expiry Date:** 2029-07-22",
|
|
531
|
+
"pageCount": 1,
|
|
532
|
+
"model": "max",
|
|
533
|
+
"html": "<h1>Passport — John A. Smith</h1><p><strong>Full Name:</strong> John Alexander Smith</p><p><strong>Nationality:</strong> United States</p>",
|
|
534
|
+
"documentType": "passport",
|
|
535
|
+
"requestId": 42
|
|
536
|
+
}`,
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
id: "identity-ask",
|
|
540
|
+
label: "Ask",
|
|
541
|
+
group: "Identity",
|
|
542
|
+
curl: `curl -X POST https://global.pdfvector.com/api/identity/ask \\
|
|
543
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
544
|
+
-H "Content-Type: application/json" \\
|
|
545
|
+
-H "x-pdfvector-document-id: passport-456" \\
|
|
546
|
+
-d '{
|
|
547
|
+
"url": "https://example.com/passport-scan.jpg",
|
|
548
|
+
"question": "What is the expiry date?",
|
|
549
|
+
"model": "max"
|
|
550
|
+
}'`,
|
|
551
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
552
|
+
|
|
553
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
554
|
+
|
|
555
|
+
const result = await client.identity.ask(
|
|
556
|
+
{
|
|
557
|
+
url: "https://example.com/passport-scan.jpg",
|
|
558
|
+
question: "What is the expiry date?",
|
|
559
|
+
model: "max",
|
|
560
|
+
},
|
|
561
|
+
{ context: { documentId: "passport-456" } },
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
console.log(result.markdown);`,
|
|
565
|
+
python: `import requests
|
|
566
|
+
|
|
567
|
+
response = requests.post(
|
|
568
|
+
"https://global.pdfvector.com/api/identity/ask",
|
|
569
|
+
headers={
|
|
570
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
571
|
+
"x-pdfvector-document-id": "passport-456",
|
|
572
|
+
},
|
|
573
|
+
json={
|
|
574
|
+
"url": "https://example.com/passport-scan.jpg",
|
|
575
|
+
"question": "What is the expiry date?",
|
|
576
|
+
"model": "max",
|
|
577
|
+
},
|
|
578
|
+
)
|
|
579
|
+
data = response.json()
|
|
580
|
+
print(data["markdown"])`,
|
|
581
|
+
response: `{
|
|
582
|
+
"documentId": "passport-456",
|
|
583
|
+
"markdown": "The expiry date on the passport is July 22, 2029.",
|
|
584
|
+
"model": "max",
|
|
585
|
+
"requestId": 43
|
|
586
|
+
}`,
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
id: "identity-extract",
|
|
590
|
+
label: "Extract",
|
|
591
|
+
group: "Identity",
|
|
592
|
+
curl: `curl -X POST https://global.pdfvector.com/api/identity/extract \\
|
|
593
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
594
|
+
-H "Content-Type: application/json" \\
|
|
595
|
+
-H "x-pdfvector-document-id: passport-456" \\
|
|
596
|
+
-d '{
|
|
597
|
+
"url": "https://example.com/passport-scan.jpg",
|
|
598
|
+
"prompt": "Extract the full name, date of birth, nationality, passport number, and expiry date",
|
|
599
|
+
"schema": {
|
|
600
|
+
"type": "object",
|
|
601
|
+
"properties": {
|
|
602
|
+
"fullName": { "type": "string" },
|
|
603
|
+
"dateOfBirth": { "type": "string" },
|
|
604
|
+
"nationality": { "type": "string" },
|
|
605
|
+
"passportNumber": { "type": "string" },
|
|
606
|
+
"expiryDate": { "type": "string" }
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
"model": "max"
|
|
610
|
+
}'`,
|
|
611
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
612
|
+
|
|
613
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
614
|
+
|
|
615
|
+
const result = await client.identity.extract(
|
|
616
|
+
{
|
|
617
|
+
url: "https://example.com/passport-scan.jpg",
|
|
618
|
+
prompt: "Extract the full name, date of birth, nationality, passport number, and expiry date",
|
|
619
|
+
schema: {
|
|
620
|
+
type: "object",
|
|
621
|
+
properties: {
|
|
622
|
+
fullName: { type: "string" },
|
|
623
|
+
dateOfBirth: { type: "string" },
|
|
624
|
+
nationality: { type: "string" },
|
|
625
|
+
passportNumber: { type: "string" },
|
|
626
|
+
expiryDate: { type: "string" },
|
|
627
|
+
},
|
|
628
|
+
},
|
|
629
|
+
model: "max",
|
|
630
|
+
},
|
|
631
|
+
{ context: { documentId: "passport-456" } },
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
console.log(result.data);`,
|
|
635
|
+
python: `import requests
|
|
636
|
+
|
|
637
|
+
response = requests.post(
|
|
638
|
+
"https://global.pdfvector.com/api/identity/extract",
|
|
639
|
+
headers={
|
|
640
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
641
|
+
"x-pdfvector-document-id": "passport-456",
|
|
642
|
+
},
|
|
643
|
+
json={
|
|
644
|
+
"url": "https://example.com/passport-scan.jpg",
|
|
645
|
+
"prompt": "Extract the full name, date of birth, nationality, passport number, and expiry date",
|
|
646
|
+
"schema": {
|
|
647
|
+
"type": "object",
|
|
648
|
+
"properties": {
|
|
649
|
+
"fullName": {"type": "string"},
|
|
650
|
+
"dateOfBirth": {"type": "string"},
|
|
651
|
+
"nationality": {"type": "string"},
|
|
652
|
+
"passportNumber": {"type": "string"},
|
|
653
|
+
"expiryDate": {"type": "string"},
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
"model": "max",
|
|
657
|
+
},
|
|
658
|
+
)
|
|
659
|
+
data = response.json()
|
|
660
|
+
print(data["data"])`,
|
|
661
|
+
response: `{
|
|
662
|
+
"documentId": "passport-456",
|
|
663
|
+
"data": {
|
|
664
|
+
"fullName": "John Alexander Smith",
|
|
665
|
+
"dateOfBirth": "1985-03-15",
|
|
666
|
+
"nationality": "United States",
|
|
667
|
+
"passportNumber": "E12345678",
|
|
668
|
+
"expiryDate": "2029-07-22"
|
|
669
|
+
},
|
|
670
|
+
"model": "max",
|
|
671
|
+
"requestId": 44
|
|
672
|
+
}`,
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
id: "invoice-parse",
|
|
676
|
+
label: "Parse",
|
|
677
|
+
group: "Invoice",
|
|
678
|
+
curl: `curl -X POST https://global.pdfvector.com/api/invoice/parse \\
|
|
679
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
680
|
+
-H "Content-Type: application/json" \\
|
|
681
|
+
-H "x-pdfvector-document-id: inv-2024-0892" \\
|
|
682
|
+
-d '{
|
|
683
|
+
"url": "https://example.com/supplier-invoice.pdf",
|
|
684
|
+
"model": "max"
|
|
685
|
+
}'`,
|
|
686
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
687
|
+
|
|
688
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
689
|
+
|
|
690
|
+
const result = await client.invoice.parse(
|
|
691
|
+
{ url: "https://example.com/supplier-invoice.pdf", model: "max" },
|
|
692
|
+
{ context: { documentId: "inv-2024-0892" } },
|
|
693
|
+
);
|
|
694
|
+
|
|
695
|
+
console.log(result.markdown);
|
|
696
|
+
console.log(\`Pages: \${result.pageCount}, Model: \${result.model}\`);`,
|
|
697
|
+
python: `import requests
|
|
698
|
+
|
|
699
|
+
response = requests.post(
|
|
700
|
+
"https://global.pdfvector.com/api/invoice/parse",
|
|
701
|
+
headers={
|
|
702
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
703
|
+
"x-pdfvector-document-id": "inv-2024-0892",
|
|
704
|
+
},
|
|
705
|
+
json={
|
|
706
|
+
"url": "https://example.com/supplier-invoice.pdf",
|
|
707
|
+
"model": "max",
|
|
708
|
+
},
|
|
709
|
+
)
|
|
710
|
+
data = response.json()
|
|
711
|
+
print(data["markdown"])`,
|
|
712
|
+
response: `{
|
|
713
|
+
"documentId": "inv-2024-0892",
|
|
714
|
+
"markdown": "# Invoice #INV-2024-0892\\n\\n**Vendor:** TechSupply Co.\\n**Date:** 2024-11-15\\n**Due Date:** 2024-12-15\\n\\n| Item | Qty | Price |\\n|------|-----|-------|\\n| Server Rack | 2 | $3,400.00 |\\n| Network Switch | 4 | $1,200.00 |\\n\\n**Total: $4,600.00**",
|
|
715
|
+
"pageCount": 1,
|
|
716
|
+
"model": "max",
|
|
717
|
+
"html": "<h1>Invoice #INV-2024-0892</h1><p><strong>Vendor:</strong> TechSupply Co.</p><table><tr><td>Server Rack</td><td>$3,400.00</td></tr></table>",
|
|
718
|
+
"requestId": 42
|
|
719
|
+
}`,
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
id: "invoice-ask",
|
|
723
|
+
label: "Ask",
|
|
724
|
+
group: "Invoice",
|
|
725
|
+
curl: `curl -X POST https://global.pdfvector.com/api/invoice/ask \\
|
|
726
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
727
|
+
-H "Content-Type: application/json" \\
|
|
728
|
+
-H "x-pdfvector-document-id: inv-2024-0892" \\
|
|
729
|
+
-d '{
|
|
730
|
+
"url": "https://example.com/supplier-invoice.pdf",
|
|
731
|
+
"question": "What is the total amount due?",
|
|
732
|
+
"model": "max"
|
|
733
|
+
}'`,
|
|
734
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
735
|
+
|
|
736
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
737
|
+
|
|
738
|
+
const result = await client.invoice.ask(
|
|
739
|
+
{
|
|
740
|
+
url: "https://example.com/supplier-invoice.pdf",
|
|
741
|
+
question: "What is the total amount due?",
|
|
742
|
+
model: "max",
|
|
743
|
+
},
|
|
744
|
+
{ context: { documentId: "inv-2024-0892" } },
|
|
745
|
+
);
|
|
746
|
+
|
|
747
|
+
console.log(result.markdown);`,
|
|
748
|
+
python: `import requests
|
|
749
|
+
|
|
750
|
+
response = requests.post(
|
|
751
|
+
"https://global.pdfvector.com/api/invoice/ask",
|
|
752
|
+
headers={
|
|
753
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
754
|
+
"x-pdfvector-document-id": "inv-2024-0892",
|
|
755
|
+
},
|
|
756
|
+
json={
|
|
757
|
+
"url": "https://example.com/supplier-invoice.pdf",
|
|
758
|
+
"question": "What is the total amount due?",
|
|
759
|
+
"model": "max",
|
|
760
|
+
},
|
|
761
|
+
)
|
|
762
|
+
data = response.json()
|
|
763
|
+
print(data["markdown"])`,
|
|
764
|
+
response: `{
|
|
765
|
+
"documentId": "inv-2024-0892",
|
|
766
|
+
"markdown": "The total amount due on invoice #INV-2024-0892 is $4,600.00, with a payment due date of December 15, 2024.",
|
|
767
|
+
"model": "max",
|
|
768
|
+
"requestId": 43
|
|
769
|
+
}`,
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
id: "invoice-extract",
|
|
773
|
+
label: "Extract",
|
|
774
|
+
group: "Invoice",
|
|
775
|
+
curl: `curl -X POST https://global.pdfvector.com/api/invoice/extract \\
|
|
776
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
777
|
+
-H "Content-Type: application/json" \\
|
|
778
|
+
-H "x-pdfvector-document-id: inv-2024-0892" \\
|
|
779
|
+
-d '{
|
|
780
|
+
"url": "https://example.com/supplier-invoice.pdf",
|
|
781
|
+
"prompt": "Extract vendor name, invoice number, date, total amount, and all line items",
|
|
782
|
+
"schema": {
|
|
783
|
+
"type": "object",
|
|
784
|
+
"properties": {
|
|
785
|
+
"vendor": { "type": "string" },
|
|
786
|
+
"invoiceNumber": { "type": "string" },
|
|
787
|
+
"date": { "type": "string" },
|
|
788
|
+
"total": { "type": "number" },
|
|
789
|
+
"lineItems": {
|
|
790
|
+
"type": "array",
|
|
791
|
+
"items": {
|
|
792
|
+
"type": "object",
|
|
793
|
+
"properties": {
|
|
794
|
+
"description": { "type": "string" },
|
|
795
|
+
"quantity": { "type": "number" },
|
|
796
|
+
"unitPrice": { "type": "number" },
|
|
797
|
+
"amount": { "type": "number" }
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
"model": "max"
|
|
804
|
+
}'`,
|
|
805
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
806
|
+
|
|
807
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
808
|
+
|
|
809
|
+
const result = await client.invoice.extract(
|
|
810
|
+
{
|
|
811
|
+
url: "https://example.com/supplier-invoice.pdf",
|
|
812
|
+
prompt: "Extract vendor name, invoice number, date, total amount, and all line items",
|
|
813
|
+
schema: {
|
|
814
|
+
type: "object",
|
|
815
|
+
properties: {
|
|
816
|
+
vendor: { type: "string" },
|
|
817
|
+
invoiceNumber: { type: "string" },
|
|
818
|
+
date: { type: "string" },
|
|
819
|
+
total: { type: "number" },
|
|
820
|
+
lineItems: {
|
|
821
|
+
type: "array",
|
|
822
|
+
items: {
|
|
823
|
+
type: "object",
|
|
824
|
+
properties: {
|
|
825
|
+
description: { type: "string" },
|
|
826
|
+
quantity: { type: "number" },
|
|
827
|
+
unitPrice: { type: "number" },
|
|
828
|
+
amount: { type: "number" },
|
|
829
|
+
},
|
|
830
|
+
},
|
|
831
|
+
},
|
|
832
|
+
},
|
|
833
|
+
},
|
|
834
|
+
model: "max",
|
|
835
|
+
},
|
|
836
|
+
{ context: { documentId: "inv-2024-0892" } },
|
|
837
|
+
);
|
|
838
|
+
|
|
839
|
+
console.log(result.data);`,
|
|
840
|
+
python: `import requests
|
|
841
|
+
|
|
842
|
+
response = requests.post(
|
|
843
|
+
"https://global.pdfvector.com/api/invoice/extract",
|
|
844
|
+
headers={
|
|
845
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
846
|
+
"x-pdfvector-document-id": "inv-2024-0892",
|
|
847
|
+
},
|
|
848
|
+
json={
|
|
849
|
+
"url": "https://example.com/supplier-invoice.pdf",
|
|
850
|
+
"prompt": "Extract vendor name, invoice number, date, total amount, and all line items",
|
|
851
|
+
"schema": {
|
|
852
|
+
"type": "object",
|
|
853
|
+
"properties": {
|
|
854
|
+
"vendor": {"type": "string"},
|
|
855
|
+
"invoiceNumber": {"type": "string"},
|
|
856
|
+
"date": {"type": "string"},
|
|
857
|
+
"total": {"type": "number"},
|
|
858
|
+
"lineItems": {
|
|
859
|
+
"type": "array",
|
|
860
|
+
"items": {
|
|
861
|
+
"type": "object",
|
|
862
|
+
"properties": {
|
|
863
|
+
"description": {"type": "string"},
|
|
864
|
+
"quantity": {"type": "number"},
|
|
865
|
+
"unitPrice": {"type": "number"},
|
|
866
|
+
"amount": {"type": "number"},
|
|
867
|
+
},
|
|
868
|
+
},
|
|
869
|
+
},
|
|
870
|
+
},
|
|
871
|
+
},
|
|
872
|
+
"model": "max",
|
|
873
|
+
},
|
|
874
|
+
)
|
|
875
|
+
data = response.json()
|
|
876
|
+
print(data["data"])`,
|
|
877
|
+
response: `{
|
|
878
|
+
"documentId": "inv-2024-0892",
|
|
879
|
+
"data": {
|
|
880
|
+
"vendor": "TechSupply Co.",
|
|
881
|
+
"invoiceNumber": "INV-2024-0892",
|
|
882
|
+
"date": "2024-11-15",
|
|
883
|
+
"total": 4600.00,
|
|
884
|
+
"lineItems": [
|
|
885
|
+
{ "description": "Server Rack", "quantity": 2, "unitPrice": 1700.00, "amount": 3400.00 },
|
|
886
|
+
{ "description": "Network Switch", "quantity": 4, "unitPrice": 300.00, "amount": 1200.00 }
|
|
887
|
+
]
|
|
888
|
+
},
|
|
889
|
+
"model": "max",
|
|
890
|
+
"requestId": 44
|
|
891
|
+
}`,
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
id: "bank-statement-parse",
|
|
895
|
+
label: "Parse",
|
|
896
|
+
group: "Bank Statement",
|
|
897
|
+
curl: `curl -X POST https://global.pdfvector.com/api/bankStatement/parse \\
|
|
898
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
899
|
+
-H "Content-Type: application/json" \\
|
|
900
|
+
-H "x-pdfvector-document-id: stmt-nov-2024" \\
|
|
901
|
+
-d '{
|
|
902
|
+
"url": "https://example.com/monthly-statement.pdf",
|
|
903
|
+
"model": "max"
|
|
904
|
+
}'`,
|
|
905
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
906
|
+
|
|
907
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
908
|
+
|
|
909
|
+
const result = await client.bankStatement.parse(
|
|
910
|
+
{ url: "https://example.com/monthly-statement.pdf", model: "max" },
|
|
911
|
+
{ context: { documentId: "stmt-nov-2024" } },
|
|
912
|
+
);
|
|
913
|
+
|
|
914
|
+
console.log(result.markdown);
|
|
915
|
+
console.log(\`Pages: \${result.pageCount}, Model: \${result.model}\`);`,
|
|
916
|
+
python: `import requests
|
|
917
|
+
|
|
918
|
+
response = requests.post(
|
|
919
|
+
"https://global.pdfvector.com/api/bankStatement/parse",
|
|
920
|
+
headers={
|
|
921
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
922
|
+
"x-pdfvector-document-id": "stmt-nov-2024",
|
|
923
|
+
},
|
|
924
|
+
json={
|
|
925
|
+
"url": "https://example.com/monthly-statement.pdf",
|
|
926
|
+
"model": "max",
|
|
927
|
+
},
|
|
928
|
+
)
|
|
929
|
+
data = response.json()
|
|
930
|
+
print(data["markdown"])`,
|
|
931
|
+
response: `{
|
|
932
|
+
"documentId": "stmt-nov-2024",
|
|
933
|
+
"markdown": "# Bank Statement — Chase Checking ****4821\\n\\n**Period:** Nov 1 – Nov 30, 2024\\n**Opening Balance:** $12,450.33\\n**Closing Balance:** $14,892.17\\n\\n| Date | Description | Amount |\\n|------|-------------|--------|\\n| 11/02 | Direct Deposit | +$5,200.00 |\\n| 11/05 | Rent Payment | -$2,100.00 |",
|
|
934
|
+
"pageCount": 3,
|
|
935
|
+
"model": "max",
|
|
936
|
+
"html": "<h1>Bank Statement — Chase Checking ****4821</h1><table><tr><td>11/02</td><td>Direct Deposit</td><td>+$5,200.00</td></tr></table>",
|
|
937
|
+
"requestId": 42
|
|
938
|
+
}`,
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
id: "bank-statement-ask",
|
|
942
|
+
label: "Ask",
|
|
943
|
+
group: "Bank Statement",
|
|
944
|
+
curl: `curl -X POST https://global.pdfvector.com/api/bankStatement/ask \\
|
|
945
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
946
|
+
-H "Content-Type: application/json" \\
|
|
947
|
+
-H "x-pdfvector-document-id: stmt-nov-2024" \\
|
|
948
|
+
-d '{
|
|
949
|
+
"url": "https://example.com/monthly-statement.pdf",
|
|
950
|
+
"question": "What is the closing balance?",
|
|
951
|
+
"model": "max"
|
|
952
|
+
}'`,
|
|
953
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
954
|
+
|
|
955
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
956
|
+
|
|
957
|
+
const result = await client.bankStatement.ask(
|
|
958
|
+
{
|
|
959
|
+
url: "https://example.com/monthly-statement.pdf",
|
|
960
|
+
question: "What is the closing balance?",
|
|
961
|
+
model: "max",
|
|
962
|
+
},
|
|
963
|
+
{ context: { documentId: "stmt-nov-2024" } },
|
|
964
|
+
);
|
|
965
|
+
|
|
966
|
+
console.log(result.markdown);`,
|
|
967
|
+
python: `import requests
|
|
968
|
+
|
|
969
|
+
response = requests.post(
|
|
970
|
+
"https://global.pdfvector.com/api/bankStatement/ask",
|
|
971
|
+
headers={
|
|
972
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
973
|
+
"x-pdfvector-document-id": "stmt-nov-2024",
|
|
974
|
+
},
|
|
975
|
+
json={
|
|
976
|
+
"url": "https://example.com/monthly-statement.pdf",
|
|
977
|
+
"question": "What is the closing balance?",
|
|
978
|
+
"model": "max",
|
|
979
|
+
},
|
|
980
|
+
)
|
|
981
|
+
data = response.json()
|
|
982
|
+
print(data["markdown"])`,
|
|
983
|
+
response: `{
|
|
984
|
+
"documentId": "stmt-nov-2024",
|
|
985
|
+
"markdown": "The closing balance for the statement period ending November 30, 2024 is $14,892.17.",
|
|
986
|
+
"model": "max",
|
|
987
|
+
"requestId": 43
|
|
988
|
+
}`,
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
id: "bank-statement-extract",
|
|
992
|
+
label: "Extract",
|
|
993
|
+
group: "Bank Statement",
|
|
994
|
+
curl: `curl -X POST https://global.pdfvector.com/api/bankStatement/extract \\
|
|
995
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
996
|
+
-H "Content-Type: application/json" \\
|
|
997
|
+
-H "x-pdfvector-document-id: stmt-nov-2024" \\
|
|
998
|
+
-d '{
|
|
999
|
+
"url": "https://example.com/monthly-statement.pdf",
|
|
1000
|
+
"prompt": "Extract account holder, opening balance, closing balance, statement period, and all transactions",
|
|
1001
|
+
"schema": {
|
|
1002
|
+
"type": "object",
|
|
1003
|
+
"properties": {
|
|
1004
|
+
"accountHolder": { "type": "string" },
|
|
1005
|
+
"openingBalance": { "type": "number" },
|
|
1006
|
+
"closingBalance": { "type": "number" },
|
|
1007
|
+
"statementPeriod": { "type": "string" },
|
|
1008
|
+
"transactions": {
|
|
1009
|
+
"type": "array",
|
|
1010
|
+
"items": {
|
|
1011
|
+
"type": "object",
|
|
1012
|
+
"properties": {
|
|
1013
|
+
"date": { "type": "string" },
|
|
1014
|
+
"description": { "type": "string" },
|
|
1015
|
+
"amount": { "type": "number" },
|
|
1016
|
+
"balance": { "type": "number" }
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
"model": "max"
|
|
1023
|
+
}'`,
|
|
1024
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1025
|
+
|
|
1026
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1027
|
+
|
|
1028
|
+
const result = await client.bankStatement.extract(
|
|
1029
|
+
{
|
|
1030
|
+
url: "https://example.com/monthly-statement.pdf",
|
|
1031
|
+
prompt: "Extract account holder, opening balance, closing balance, statement period, and all transactions",
|
|
1032
|
+
schema: {
|
|
1033
|
+
type: "object",
|
|
1034
|
+
properties: {
|
|
1035
|
+
accountHolder: { type: "string" },
|
|
1036
|
+
openingBalance: { type: "number" },
|
|
1037
|
+
closingBalance: { type: "number" },
|
|
1038
|
+
statementPeriod: { type: "string" },
|
|
1039
|
+
transactions: {
|
|
1040
|
+
type: "array",
|
|
1041
|
+
items: {
|
|
1042
|
+
type: "object",
|
|
1043
|
+
properties: {
|
|
1044
|
+
date: { type: "string" },
|
|
1045
|
+
description: { type: "string" },
|
|
1046
|
+
amount: { type: "number" },
|
|
1047
|
+
balance: { type: "number" },
|
|
1048
|
+
},
|
|
1049
|
+
},
|
|
1050
|
+
},
|
|
1051
|
+
},
|
|
1052
|
+
},
|
|
1053
|
+
model: "max",
|
|
1054
|
+
},
|
|
1055
|
+
{ context: { documentId: "stmt-nov-2024" } },
|
|
1056
|
+
);
|
|
1057
|
+
|
|
1058
|
+
console.log(result.data);`,
|
|
1059
|
+
python: `import requests
|
|
1060
|
+
|
|
1061
|
+
response = requests.post(
|
|
1062
|
+
"https://global.pdfvector.com/api/bankStatement/extract",
|
|
1063
|
+
headers={
|
|
1064
|
+
"Authorization": "Bearer YOUR_API_KEY",
|
|
1065
|
+
"x-pdfvector-document-id": "stmt-nov-2024",
|
|
1066
|
+
},
|
|
1067
|
+
json={
|
|
1068
|
+
"url": "https://example.com/monthly-statement.pdf",
|
|
1069
|
+
"prompt": "Extract account holder, opening balance, closing balance, statement period, and all transactions",
|
|
1070
|
+
"schema": {
|
|
1071
|
+
"type": "object",
|
|
1072
|
+
"properties": {
|
|
1073
|
+
"accountHolder": {"type": "string"},
|
|
1074
|
+
"openingBalance": {"type": "number"},
|
|
1075
|
+
"closingBalance": {"type": "number"},
|
|
1076
|
+
"statementPeriod": {"type": "string"},
|
|
1077
|
+
"transactions": {
|
|
1078
|
+
"type": "array",
|
|
1079
|
+
"items": {
|
|
1080
|
+
"type": "object",
|
|
1081
|
+
"properties": {
|
|
1082
|
+
"date": {"type": "string"},
|
|
1083
|
+
"description": {"type": "string"},
|
|
1084
|
+
"amount": {"type": "number"},
|
|
1085
|
+
"balance": {"type": "number"},
|
|
1086
|
+
},
|
|
1087
|
+
},
|
|
1088
|
+
},
|
|
1089
|
+
},
|
|
1090
|
+
},
|
|
1091
|
+
"model": "max",
|
|
1092
|
+
},
|
|
1093
|
+
)
|
|
1094
|
+
data = response.json()
|
|
1095
|
+
print(data["data"])`,
|
|
1096
|
+
response: `{
|
|
1097
|
+
"documentId": "stmt-nov-2024",
|
|
1098
|
+
"data": {
|
|
1099
|
+
"accountHolder": "John A. Smith",
|
|
1100
|
+
"openingBalance": 12450.33,
|
|
1101
|
+
"closingBalance": 14892.17,
|
|
1102
|
+
"statementPeriod": "Nov 1 – Nov 30, 2024",
|
|
1103
|
+
"transactions": [
|
|
1104
|
+
{ "date": "2024-11-02", "description": "Direct Deposit - Employer", "amount": 5200.00, "balance": 17650.33 },
|
|
1105
|
+
{ "date": "2024-11-05", "description": "Rent Payment", "amount": -2100.00, "balance": 15550.33 },
|
|
1106
|
+
{ "date": "2024-11-12", "description": "Grocery Store", "amount": -187.43, "balance": 15362.90 },
|
|
1107
|
+
{ "date": "2024-11-18", "description": "Utility Bill", "amount": -245.73, "balance": 15117.17 }
|
|
1108
|
+
]
|
|
1109
|
+
},
|
|
1110
|
+
"model": "max",
|
|
1111
|
+
"requestId": 44
|
|
1112
|
+
}`,
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
id: "academic-search",
|
|
1116
|
+
label: "Search",
|
|
1117
|
+
group: "Academic",
|
|
1118
|
+
curl: `curl -X POST https://global.pdfvector.com/api/academic/search \\
|
|
1119
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
1120
|
+
-H "Content-Type: application/json" \\
|
|
1121
|
+
-d '{
|
|
1122
|
+
"query": "transformer attention mechanism",
|
|
1123
|
+
"providers": ["semantic-scholar", "pubmed", "openalex", "europe-pmc"],
|
|
1124
|
+
"limit": 10,
|
|
1125
|
+
"offset": 0,
|
|
1126
|
+
"yearFrom": 2017,
|
|
1127
|
+
"yearTo": 2025,
|
|
1128
|
+
"fields": ["title", "authors", "year", "doi", "citationCount"]
|
|
1129
|
+
}'`,
|
|
1130
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1131
|
+
|
|
1132
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1133
|
+
|
|
1134
|
+
const result = await client.academic.search({
|
|
1135
|
+
query: "transformer attention mechanism",
|
|
1136
|
+
providers: ["semantic-scholar", "pubmed", "openalex", "europe-pmc"],
|
|
1137
|
+
limit: 10,
|
|
1138
|
+
offset: 0,
|
|
1139
|
+
yearFrom: 2017,
|
|
1140
|
+
yearTo: 2025,
|
|
1141
|
+
fields: ["title", "authors", "year", "doi", "totalCitations"],
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
console.log(\`Found \${result.estimatedTotalResults} results\`);
|
|
1145
|
+
for (const paper of result.results) {
|
|
1146
|
+
console.log(\`\${paper.title} (\${paper.year})\`);
|
|
1147
|
+
}`,
|
|
1148
|
+
python: `import requests
|
|
1149
|
+
|
|
1150
|
+
response = requests.post(
|
|
1151
|
+
"https://global.pdfvector.com/api/academic/search",
|
|
1152
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1153
|
+
json={
|
|
1154
|
+
"query": "transformer attention mechanism",
|
|
1155
|
+
"providers": ["semantic-scholar", "pubmed", "openalex", "europe-pmc"],
|
|
1156
|
+
"limit": 10,
|
|
1157
|
+
"offset": 0,
|
|
1158
|
+
"yearFrom": 2017,
|
|
1159
|
+
"yearTo": 2025,
|
|
1160
|
+
"fields": ["title", "authors", "year", "doi", "citationCount"],
|
|
1161
|
+
},
|
|
1162
|
+
)
|
|
1163
|
+
data = response.json()
|
|
1164
|
+
print(f"Found {data['estimatedTotalResults']} results")`,
|
|
1165
|
+
response: `{
|
|
1166
|
+
"estimatedTotalResults": 48293,
|
|
1167
|
+
"results": [
|
|
1168
|
+
{
|
|
1169
|
+
"doi": "10.48550/arXiv.1706.03762",
|
|
1170
|
+
"title": "Attention Is All You Need",
|
|
1171
|
+
"authors": [{"name": "Ashish Vaswani"}, {"name": "Noam Shazeer"}],
|
|
1172
|
+
"year": 2017,
|
|
1173
|
+
"totalCitations": 120843,
|
|
1174
|
+
"abstract": "The dominant sequence transduction models...",
|
|
1175
|
+
"provider": "semantic-scholar"
|
|
1176
|
+
},
|
|
1177
|
+
{
|
|
1178
|
+
"doi": "10.18653/v1/N19-1423",
|
|
1179
|
+
"title": "BERT: Pre-training of Deep Bidirectional Transformers",
|
|
1180
|
+
"authors": [{"name": "Jacob Devlin"}, {"name": "Ming-Wei Chang"}],
|
|
1181
|
+
"year": 2019,
|
|
1182
|
+
"totalCitations": 95421,
|
|
1183
|
+
"provider": "semantic-scholar"
|
|
1184
|
+
}
|
|
1185
|
+
],
|
|
1186
|
+
"requestId": 45
|
|
1187
|
+
}`,
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
id: "academic-fetch",
|
|
1191
|
+
label: "Fetch",
|
|
1192
|
+
group: "Academic",
|
|
1193
|
+
curl: `curl -X POST https://global.pdfvector.com/api/academic/fetch \\
|
|
1194
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
1195
|
+
-H "Content-Type: application/json" \\
|
|
1196
|
+
-d '{
|
|
1197
|
+
"ids": ["10.1038/s41586-021-03819-2", "2303.08774", "PMID:33116299"],
|
|
1198
|
+
"fields": ["title", "authors", "year", "doi", "abstract", "citationCount"]
|
|
1199
|
+
}'`,
|
|
1200
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1201
|
+
|
|
1202
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1203
|
+
|
|
1204
|
+
const result = await client.academic.fetch({
|
|
1205
|
+
ids: ["10.1038/s41586-021-03819-2", "2303.08774", "PMID:33116299"],
|
|
1206
|
+
fields: ["title", "authors", "year", "doi", "abstract", "totalCitations"],
|
|
1207
|
+
});
|
|
1208
|
+
|
|
1209
|
+
for (const paper of result.results) {
|
|
1210
|
+
console.log(\`\${paper.title} — \${paper.detectedProvider}\`);
|
|
1211
|
+
}`,
|
|
1212
|
+
python: `import requests
|
|
1213
|
+
|
|
1214
|
+
response = requests.post(
|
|
1215
|
+
"https://global.pdfvector.com/api/academic/fetch",
|
|
1216
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1217
|
+
json={
|
|
1218
|
+
"ids": ["10.1038/s41586-021-03819-2", "2303.08774", "PMID:33116299"],
|
|
1219
|
+
"fields": ["title", "authors", "year", "doi", "abstract", "citationCount"],
|
|
1220
|
+
},
|
|
1221
|
+
)
|
|
1222
|
+
for paper in response.json()["results"]:
|
|
1223
|
+
print(paper["title"])`,
|
|
1224
|
+
response: `{
|
|
1225
|
+
"results": [
|
|
1226
|
+
{
|
|
1227
|
+
"id": "10.1038/s41586-021-03819-2",
|
|
1228
|
+
"detectedProvider": "semantic-scholar",
|
|
1229
|
+
"doi": "10.1038/s41586-021-03819-2",
|
|
1230
|
+
"title": "Highly accurate protein structure prediction with AlphaFold",
|
|
1231
|
+
"authors": [{"name": "John Jumper"}, {"name": "Richard Evans"}],
|
|
1232
|
+
"year": 2021,
|
|
1233
|
+
"totalCitations": 28451,
|
|
1234
|
+
"url": "https://global.pdfvector.com/publications/doi:10.1038%2Fs41586-021-03819-2",
|
|
1235
|
+
"providerURL": "https://www.semanticscholar.org/paper/fcc0b70984..."
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
"id": "2303.08774",
|
|
1239
|
+
"detectedProvider": "arxiv",
|
|
1240
|
+
"title": "GPT-4 Technical Report",
|
|
1241
|
+
"authors": [{"name": "OpenAI"}],
|
|
1242
|
+
"year": 2023,
|
|
1243
|
+
"url": "https://global.pdfvector.com/publications/arxiv:2303.08774",
|
|
1244
|
+
"providerURL": "https://arxiv.org/abs/2303.08774"
|
|
1245
|
+
}
|
|
1246
|
+
],
|
|
1247
|
+
"requestId": 46
|
|
1248
|
+
}`,
|
|
1249
|
+
},
|
|
1250
|
+
academicParseCodeExample,
|
|
1251
|
+
{
|
|
1252
|
+
id: "academic-find-citations",
|
|
1253
|
+
label: "Find Citations",
|
|
1254
|
+
group: "Academic",
|
|
1255
|
+
curl: `curl -X POST https://global.pdfvector.com/api/academic/findCitations \\
|
|
1256
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
1257
|
+
-H "Content-Type: application/json" \\
|
|
1258
|
+
-d '{
|
|
1259
|
+
"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.",
|
|
1260
|
+
"providers": ["semantic-scholar", "openalex"],
|
|
1261
|
+
"fields": ["title", "authors", "year", "doi", "citationCount"]
|
|
1262
|
+
}'`,
|
|
1263
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1264
|
+
|
|
1265
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1266
|
+
|
|
1267
|
+
const result = await client.academic.findCitations({
|
|
1268
|
+
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.",
|
|
1269
|
+
providers: ["semantic-scholar", "openalex"],
|
|
1270
|
+
fields: ["title", "authors", "year", "doi", "totalCitations"],
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
console.log(\`Found \${result.totalCitations} citations\`);
|
|
1274
|
+
for (const item of result.results) {
|
|
1275
|
+
console.log(\`"\${item.sentence}"\`);
|
|
1276
|
+
for (const cite of item.citations) {
|
|
1277
|
+
console.log(\` [\${cite.score}] \${cite.title}\`);
|
|
1278
|
+
}
|
|
1279
|
+
}`,
|
|
1280
|
+
python: `import requests
|
|
1281
|
+
|
|
1282
|
+
response = requests.post(
|
|
1283
|
+
"https://global.pdfvector.com/api/academic/findCitations",
|
|
1284
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1285
|
+
json={
|
|
1286
|
+
"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.",
|
|
1287
|
+
"providers": ["semantic-scholar", "openalex"],
|
|
1288
|
+
"fields": ["title", "authors", "year", "doi", "citationCount"],
|
|
1289
|
+
},
|
|
1290
|
+
)
|
|
1291
|
+
data = response.json()
|
|
1292
|
+
print(f"Found {data['totalCitations']} citations")`,
|
|
1293
|
+
response: `{
|
|
1294
|
+
"results": [
|
|
1295
|
+
{
|
|
1296
|
+
"sentence": "Deep learning has revolutionized NLP.",
|
|
1297
|
+
"citations": [
|
|
1298
|
+
{
|
|
1299
|
+
"score": 9,
|
|
1300
|
+
"doi": "10.1038/nature14539",
|
|
1301
|
+
"title": "Deep Learning",
|
|
1302
|
+
"authors": [{"name": "Ian Goodfellow"}, {"name": "Yoshua Bengio"}],
|
|
1303
|
+
"year": 2016,
|
|
1304
|
+
"totalCitations": 75000
|
|
1305
|
+
}
|
|
1306
|
+
]
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
"sentence": "Transformer architectures have become the dominant approach for sequence modeling.",
|
|
1310
|
+
"citations": [
|
|
1311
|
+
{
|
|
1312
|
+
"score": 10,
|
|
1313
|
+
"doi": "10.48550/arXiv.1706.03762",
|
|
1314
|
+
"title": "Attention Is All You Need",
|
|
1315
|
+
"authors": [{"name": "Ashish Vaswani"}],
|
|
1316
|
+
"year": 2017,
|
|
1317
|
+
"totalCitations": 120843
|
|
1318
|
+
}
|
|
1319
|
+
]
|
|
1320
|
+
}
|
|
1321
|
+
],
|
|
1322
|
+
"sentenceCount": 2,
|
|
1323
|
+
"totalCitations": 2,
|
|
1324
|
+
"requestId": 47
|
|
1325
|
+
}`,
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
id: "academic-paper-graph",
|
|
1329
|
+
label: "Paper Graph",
|
|
1330
|
+
group: "Academic",
|
|
1331
|
+
curl: `curl -X POST https://global.pdfvector.com/api/academic/paperGraph \\
|
|
1332
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
1333
|
+
-H "Content-Type: application/json" \\
|
|
1334
|
+
-d '{
|
|
1335
|
+
"id": "10.1038/nature12373",
|
|
1336
|
+
"citationsLimit": 20,
|
|
1337
|
+
"referencesLimit": 20,
|
|
1338
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"]
|
|
1339
|
+
}'`,
|
|
1340
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1341
|
+
|
|
1342
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1343
|
+
|
|
1344
|
+
const result = await client.academic.paperGraph({
|
|
1345
|
+
id: "10.1038/nature12373",
|
|
1346
|
+
citationsLimit: 20,
|
|
1347
|
+
referencesLimit: 20,
|
|
1348
|
+
fields: ["title", "authors", "year", "doi", "totalCitations"],
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
console.log(\`Paper: \${result.paper.title}\`);
|
|
1352
|
+
console.log(\`Citations: \${result.citations.length} of \${result.totalCitations}\`);
|
|
1353
|
+
console.log(\`References: \${result.references.length} of \${result.totalReferences}\`);
|
|
1354
|
+
|
|
1355
|
+
for (const cite of result.citations) {
|
|
1356
|
+
console.log(\` Cited by: \${cite.title} (\${cite.year})\`);
|
|
1357
|
+
}`,
|
|
1358
|
+
python: `import requests
|
|
1359
|
+
|
|
1360
|
+
response = requests.post(
|
|
1361
|
+
"https://global.pdfvector.com/api/academic/paperGraph",
|
|
1362
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1363
|
+
json={
|
|
1364
|
+
"id": "10.1038/nature12373",
|
|
1365
|
+
"citationsLimit": 20,
|
|
1366
|
+
"referencesLimit": 20,
|
|
1367
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"],
|
|
1368
|
+
},
|
|
1369
|
+
)
|
|
1370
|
+
data = response.json()
|
|
1371
|
+
print(f"Paper: {data['paper']['title']}")
|
|
1372
|
+
print(f"Citations: {len(data['citations'])} of {data['totalCitations']}")`,
|
|
1373
|
+
response: `{
|
|
1374
|
+
"paper": {
|
|
1375
|
+
"doi": "10.1038/nature12373",
|
|
1376
|
+
"title": "Sequence-to-sequence models for data-to-text generation",
|
|
1377
|
+
"authors": [{"name": "Sam Wiseman"}, {"name": "Stuart Shieber"}],
|
|
1378
|
+
"year": 2017,
|
|
1379
|
+
"totalCitations": 842
|
|
1380
|
+
},
|
|
1381
|
+
"citations": [
|
|
1382
|
+
{
|
|
1383
|
+
"doi": "10.18653/v1/P19-1602",
|
|
1384
|
+
"title": "Data-to-Text Generation with Content Selection and Planning",
|
|
1385
|
+
"authors": [{"name": "Ratish Puduppully"}],
|
|
1386
|
+
"year": 2019,
|
|
1387
|
+
"totalCitations": 312
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
"doi": "10.18653/v1/2020.acl-main.17",
|
|
1391
|
+
"title": "Bridging the Structural Gap Between Encoding and Decoding",
|
|
1392
|
+
"authors": [{"name": "Kaiqiang Song"}],
|
|
1393
|
+
"year": 2020,
|
|
1394
|
+
"totalCitations": 45
|
|
1395
|
+
}
|
|
1396
|
+
],
|
|
1397
|
+
"references": [
|
|
1398
|
+
{
|
|
1399
|
+
"doi": "10.48550/arXiv.1409.3215",
|
|
1400
|
+
"title": "Sequence to Sequence Learning with Neural Networks",
|
|
1401
|
+
"authors": [{"name": "Ilya Sutskever"}],
|
|
1402
|
+
"year": 2014,
|
|
1403
|
+
"totalCitations": 25891
|
|
1404
|
+
}
|
|
1405
|
+
],
|
|
1406
|
+
"totalCitations": 842,
|
|
1407
|
+
"totalReferences": 35,
|
|
1408
|
+
"requestId": 48
|
|
1409
|
+
}`,
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
id: "academic-similar-papers",
|
|
1413
|
+
label: "Similar Papers",
|
|
1414
|
+
group: "Academic",
|
|
1415
|
+
curl: `curl -X POST https://global.pdfvector.com/api/academic/similarPapers \\
|
|
1416
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
1417
|
+
-H "Content-Type: application/json" \\
|
|
1418
|
+
-d '{
|
|
1419
|
+
"id": "10.1038/nature12373",
|
|
1420
|
+
"limit": 10,
|
|
1421
|
+
"includeEdges": false,
|
|
1422
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"]
|
|
1423
|
+
}'`,
|
|
1424
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1425
|
+
|
|
1426
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1427
|
+
|
|
1428
|
+
const result = await client.academic.similarPapers({
|
|
1429
|
+
id: "10.1038/nature12373",
|
|
1430
|
+
limit: 10,
|
|
1431
|
+
includeEdges: false,
|
|
1432
|
+
fields: ["title", "authors", "year", "doi", "totalCitations"],
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
console.log(\`Seed: \${result.seed.title}\`);
|
|
1436
|
+
console.log(\`Found \${result.results.length} similar papers\`);
|
|
1437
|
+
|
|
1438
|
+
for (const item of result.results) {
|
|
1439
|
+
console.log(\` [\${item.similarity.toFixed(2)}] \${item.publication.title}\`);
|
|
1440
|
+
}`,
|
|
1441
|
+
python: `import requests
|
|
1442
|
+
|
|
1443
|
+
response = requests.post(
|
|
1444
|
+
"https://global.pdfvector.com/api/academic/similarPapers",
|
|
1445
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1446
|
+
json={
|
|
1447
|
+
"id": "10.1038/nature12373",
|
|
1448
|
+
"limit": 10,
|
|
1449
|
+
"includeEdges": False,
|
|
1450
|
+
"fields": ["title", "authors", "year", "doi", "totalCitations"],
|
|
1451
|
+
},
|
|
1452
|
+
)
|
|
1453
|
+
data = response.json()
|
|
1454
|
+
print(f"Seed: {data['seed']['title']}")
|
|
1455
|
+
for item in data["results"]:
|
|
1456
|
+
print(f" [{item['similarity']:.2f}] {item['publication']['title']}")`,
|
|
1457
|
+
response: `{
|
|
1458
|
+
"seed": {
|
|
1459
|
+
"doi": "10.1038/nature12373",
|
|
1460
|
+
"title": "Sequence-to-sequence models for data-to-text generation",
|
|
1461
|
+
"authors": [{"name": "Sam Wiseman"}],
|
|
1462
|
+
"year": 2017,
|
|
1463
|
+
"totalCitations": 842
|
|
1464
|
+
},
|
|
1465
|
+
"results": [
|
|
1466
|
+
{
|
|
1467
|
+
"publication": {
|
|
1468
|
+
"doi": "10.18653/v1/P19-1602",
|
|
1469
|
+
"title": "Data-to-Text Generation with Content Selection and Planning",
|
|
1470
|
+
"authors": [{"name": "Ratish Puduppully"}],
|
|
1471
|
+
"year": 2019,
|
|
1472
|
+
"totalCitations": 312
|
|
1473
|
+
},
|
|
1474
|
+
"similarity": 0.94,
|
|
1475
|
+
"pageRank": 0.0023,
|
|
1476
|
+
"distance": 1
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
"publication": {
|
|
1480
|
+
"doi": "10.1162/tacl_a_00302",
|
|
1481
|
+
"title": "Neural Data-to-Text Generation: A Comparison between Pipeline and End-to-End Architectures",
|
|
1482
|
+
"authors": [{"name": "Thiago Castro Ferreira"}],
|
|
1483
|
+
"year": 2019,
|
|
1484
|
+
"totalCitations": 89
|
|
1485
|
+
},
|
|
1486
|
+
"similarity": 0.87,
|
|
1487
|
+
"pageRank": 0.0018,
|
|
1488
|
+
"distance": 1
|
|
1489
|
+
}
|
|
1490
|
+
],
|
|
1491
|
+
"requestId": 49
|
|
1492
|
+
}`,
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
id: "academic-search-grants",
|
|
1496
|
+
label: "Search Grants",
|
|
1497
|
+
group: "Academic",
|
|
1498
|
+
curl: `curl -X POST https://global.pdfvector.com/api/academic/searchGrants \\
|
|
1499
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
1500
|
+
-H "Content-Type: application/json" \\
|
|
1501
|
+
-d '{
|
|
1502
|
+
"query": "machine learning healthcare",
|
|
1503
|
+
"providers": ["grants-gov", "nih-reporter"],
|
|
1504
|
+
"limit": 5,
|
|
1505
|
+
"fundingMin": 50000,
|
|
1506
|
+
"deadlineFrom": "2026-01-01",
|
|
1507
|
+
"fields": ["title", "agency", "fundingAmountMin", "fundingAmountMax", "deadlineDate", "url"]
|
|
1508
|
+
}'`,
|
|
1509
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1510
|
+
|
|
1511
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1512
|
+
|
|
1513
|
+
const result = await client.academic.searchGrants({
|
|
1514
|
+
query: "machine learning healthcare",
|
|
1515
|
+
providers: ["grants-gov", "nih-reporter"],
|
|
1516
|
+
limit: 5,
|
|
1517
|
+
fundingMin: 50000,
|
|
1518
|
+
deadlineFrom: "2026-01-01",
|
|
1519
|
+
fields: ["title", "agency", "fundingAmountMin", "fundingAmountMax", "deadlineDate", "url"],
|
|
1520
|
+
});
|
|
1521
|
+
|
|
1522
|
+
console.log(\`Found \${result.estimatedTotalResults} grants\`);
|
|
1523
|
+
for (const grant of result.results) {
|
|
1524
|
+
console.log(\`\${grant.title} — \${grant.agency}\`);
|
|
1525
|
+
console.log(\` Funding: $\${grant.fundingAmountMin?.toLocaleString()} - $\${grant.fundingAmountMax?.toLocaleString()}\`);
|
|
1526
|
+
console.log(\` Deadline: \${grant.deadlineDate}\`);
|
|
1527
|
+
}`,
|
|
1528
|
+
python: `import requests
|
|
1529
|
+
|
|
1530
|
+
response = requests.post(
|
|
1531
|
+
"https://global.pdfvector.com/api/academic/searchGrants",
|
|
1532
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1533
|
+
json={
|
|
1534
|
+
"query": "machine learning healthcare",
|
|
1535
|
+
"providers": ["grants-gov", "nih-reporter"],
|
|
1536
|
+
"limit": 5,
|
|
1537
|
+
"fundingMin": 50000,
|
|
1538
|
+
"deadlineFrom": "2026-01-01",
|
|
1539
|
+
"fields": ["title", "agency", "fundingAmountMin", "fundingAmountMax", "deadlineDate", "url"],
|
|
1540
|
+
},
|
|
1541
|
+
)
|
|
1542
|
+
data = response.json()
|
|
1543
|
+
print(f"Found {data['estimatedTotalResults']} grants")
|
|
1544
|
+
for grant in data["results"]:
|
|
1545
|
+
print(f"{grant['title']} — {grant['agency']}")`,
|
|
1546
|
+
response: `{
|
|
1547
|
+
"estimatedTotalResults": 127,
|
|
1548
|
+
"results": [
|
|
1549
|
+
{
|
|
1550
|
+
"title": "Artificial Intelligence for Transforming Healthcare Delivery",
|
|
1551
|
+
"agency": "National Institutes of Health",
|
|
1552
|
+
"fundingAmountMin": 250000,
|
|
1553
|
+
"fundingAmountMax": 500000,
|
|
1554
|
+
"deadlineDate": "2026-06-15",
|
|
1555
|
+
"url": "https://grants.nih.gov/grants/guide/rfa-files/RFA-HL-25-001.html",
|
|
1556
|
+
"provider": "nih-reporter"
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
"title": "Machine Learning Applications in Clinical Decision Support",
|
|
1560
|
+
"agency": "Department of Health and Human Services",
|
|
1561
|
+
"fundingAmountMin": 100000,
|
|
1562
|
+
"fundingAmountMax": 300000,
|
|
1563
|
+
"deadlineDate": "2026-03-31",
|
|
1564
|
+
"url": "https://www.grants.gov/search-results-detail/123456",
|
|
1565
|
+
"provider": "grants-gov"
|
|
1566
|
+
}
|
|
1567
|
+
],
|
|
1568
|
+
"requestId": 50
|
|
1569
|
+
}`,
|
|
1570
|
+
},
|
|
1571
|
+
];
|
|
1572
|
+
export function getCodeExample(id) {
|
|
1573
|
+
return publicApiCodeExamples.find((example) => example.id === id);
|
|
1574
|
+
}
|
|
1575
|
+
export function getOpenApiCodeSamples(id) {
|
|
1576
|
+
const example = getCodeExample(id);
|
|
1577
|
+
if (!example) {
|
|
1578
|
+
throw new Error(`Missing API code example for ${id}`);
|
|
1579
|
+
}
|
|
1580
|
+
return [
|
|
1581
|
+
{ lang: "cURL", source: example.curl },
|
|
1582
|
+
{ lang: "TypeScript", source: example.typescript },
|
|
1583
|
+
{ lang: "Python", source: example.python },
|
|
1584
|
+
];
|
|
1585
|
+
}
|
|
1586
|
+
export const documentParseOpenApiCodeSamples = getOpenApiCodeSamples("document-parse");
|
|
1587
|
+
export const academicParseOpenApiCodeSamples = getOpenApiCodeSamples("academic-parse");
|
|
1588
|
+
export function buildOverviewDocumentParseCodeExamples(domain) {
|
|
1589
|
+
const baseUrl = `https://${domain}`;
|
|
1590
|
+
return {
|
|
1591
|
+
curl: `curl -X POST ${baseUrl}/api/document/parse \\
|
|
1592
|
+
-H "Authorization: Bearer YOUR_API_KEY" \\
|
|
1593
|
+
-H "Content-Type: application/json" \\
|
|
1594
|
+
-d '{
|
|
1595
|
+
"url": "${overviewDocumentUrl}",
|
|
1596
|
+
"model": "auto",
|
|
1597
|
+
"includePages": true
|
|
1598
|
+
}'`,
|
|
1599
|
+
typescript: `import { createClient } from "@pdfvector/client";
|
|
1600
|
+
|
|
1601
|
+
const client = createClient({
|
|
1602
|
+
apiKey: "YOUR_API_KEY",
|
|
1603
|
+
baseURL: "${baseUrl}",
|
|
1604
|
+
});
|
|
1605
|
+
|
|
1606
|
+
const result = await client.document.parse({
|
|
1607
|
+
url: "${overviewDocumentUrl}",
|
|
1608
|
+
model: "auto",
|
|
1609
|
+
includePages: true,
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
console.log(result.markdown);
|
|
1613
|
+
console.log(result.pages?.[0]?.markdown);`,
|
|
1614
|
+
python: `import requests
|
|
1615
|
+
|
|
1616
|
+
response = requests.post(
|
|
1617
|
+
"${baseUrl}/api/document/parse",
|
|
1618
|
+
headers={"Authorization": "Bearer YOUR_API_KEY"},
|
|
1619
|
+
json={
|
|
1620
|
+
"url": "${overviewDocumentUrl}",
|
|
1621
|
+
"model": "auto",
|
|
1622
|
+
"includePages": True,
|
|
1623
|
+
},
|
|
1624
|
+
)
|
|
1625
|
+
data = response.json()
|
|
1626
|
+
print(data["markdown"])
|
|
1627
|
+
print(data["pages"][0]["markdown"])`,
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
export function buildClientReadmeDocumentParseSection() {
|
|
1631
|
+
return `Extract text content from documents:
|
|
1632
|
+
|
|
1633
|
+
\`\`\`typescript
|
|
1634
|
+
const result = await client.document.parse(
|
|
1635
|
+
{
|
|
1636
|
+
url: "https://example.com/document.pdf",
|
|
1637
|
+
model: "auto", // "auto" | "nano" | "mini" | "pro" | "max"
|
|
1638
|
+
includePages: true, // optional: return page-separated markdown
|
|
1639
|
+
},
|
|
1640
|
+
{ context: { documentId: "my-doc-123" } }, // optional, for usage tracking
|
|
1641
|
+
);
|
|
1642
|
+
|
|
1643
|
+
console.log(result.markdown); // Extracted text
|
|
1644
|
+
console.log(result.pages); // [{ pageNumber: 1, markdown: "..." }]
|
|
1645
|
+
console.log(result.pageCount); // Number of pages
|
|
1646
|
+
console.log(result.model); // Model tier used
|
|
1647
|
+
console.log(result.html); // Full HTML (only with 'max' model)
|
|
1648
|
+
console.log(result.documentId); // "my-doc-123"
|
|
1649
|
+
\`\`\``;
|
|
1650
|
+
}
|
|
1651
|
+
export function buildClientReadmeAcademicParseSection() {
|
|
1652
|
+
return `Resolve a paper ID or provider URL to its public PDF and parse it into markdown. Uses the same per-page model pricing as Document Parse.
|
|
1653
|
+
|
|
1654
|
+
\`\`\`typescript
|
|
1655
|
+
const result = await client.academic.parse({
|
|
1656
|
+
id: "${arxivId}", // DOI, PubMed ID, ArXiv ID, Semantic Scholar ID, or provider URL
|
|
1657
|
+
model: "auto", // "auto" | "nano" | "mini" | "pro" | "max"
|
|
1658
|
+
includePages: true,
|
|
1659
|
+
});
|
|
1660
|
+
|
|
1661
|
+
console.log(\`Title: \${result.title}\`);
|
|
1662
|
+
console.log(\`Provider: \${result.detectedProvider}\`);
|
|
1663
|
+
console.log(\`PDF: \${result.pdfURL}\`);
|
|
1664
|
+
console.log(result.markdown);
|
|
1665
|
+
console.log(result.pages?.[0]?.markdown);
|
|
1666
|
+
console.log(\`Pages: \${result.pageCount}, Credits: \${result.credits}\`);
|
|
1667
|
+
\`\`\``;
|
|
1668
|
+
}
|
|
1669
|
+
export function buildCreditCostsMarkdownTable() {
|
|
1670
|
+
const header = "| API | nano | mini | pro | max | Unit |\n|-----|------|------|-----|-----|------|";
|
|
1671
|
+
const rows = creditTable.map((row) => `| ${row.api} | ${row.nano} | ${row.mini} | ${row.pro} | ${row.max} | ${row.unit} |`);
|
|
1672
|
+
return [header, ...rows].join("\n");
|
|
1673
|
+
}
|
|
1674
|
+
export function buildClientReadmeCreditCostsSection() {
|
|
1675
|
+
return buildCreditCostsMarkdownTable();
|
|
1676
|
+
}
|
|
1677
|
+
function buildSkillOperationSection(example) {
|
|
1678
|
+
return `## ${example.group} ${example.label}
|
|
1679
|
+
|
|
1680
|
+
### cURL
|
|
1681
|
+
|
|
1682
|
+
\`\`\`bash
|
|
1683
|
+
${example.curl}
|
|
1684
|
+
\`\`\`
|
|
1685
|
+
|
|
1686
|
+
### TypeScript
|
|
1687
|
+
|
|
1688
|
+
\`\`\`typescript
|
|
1689
|
+
${example.typescript}
|
|
1690
|
+
\`\`\`
|
|
1691
|
+
|
|
1692
|
+
### Python
|
|
1693
|
+
|
|
1694
|
+
\`\`\`python
|
|
1695
|
+
${example.python}
|
|
1696
|
+
\`\`\`
|
|
1697
|
+
|
|
1698
|
+
### Example Response
|
|
1699
|
+
|
|
1700
|
+
\`\`\`json
|
|
1701
|
+
${example.response}
|
|
1702
|
+
\`\`\``;
|
|
1703
|
+
}
|
|
1704
|
+
export function buildPdfVectorApiSkillMarkdown() {
|
|
1705
|
+
const operations = publicApiCodeExamples
|
|
1706
|
+
.map(buildSkillOperationSection)
|
|
1707
|
+
.join("\n\n");
|
|
1708
|
+
return `---
|
|
1709
|
+
name: pdfvector-api
|
|
1710
|
+
description: Use PDF Vector public APIs for document, invoice, identity, bank statement, and academic workflows, including parsing, ask, extract, search, citations, paper graphs, similar papers, grants, pricing, and page-separated output with includePages.
|
|
1711
|
+
---
|
|
1712
|
+
|
|
1713
|
+
# PDF Vector API
|
|
1714
|
+
|
|
1715
|
+
Use this skill when a user wants to call PDF Vector public APIs from an agent or app. It covers document, invoice, identity, bank statement, and academic APIs.
|
|
1716
|
+
|
|
1717
|
+
## Sources
|
|
1718
|
+
|
|
1719
|
+
- API reference: https://global.pdfvector.com/api/reference
|
|
1720
|
+
- TypeScript SDK: https://www.npmjs.com/package/@pdfvector/client
|
|
1721
|
+
- Website: https://www.pdfvector.com
|
|
1722
|
+
|
|
1723
|
+
## Authentication
|
|
1724
|
+
|
|
1725
|
+
Use a PDF Vector API key in the \`Authorization\` header:
|
|
1726
|
+
|
|
1727
|
+
\`\`\`text
|
|
1728
|
+
Authorization: Bearer YOUR_API_KEY
|
|
1729
|
+
\`\`\`
|
|
1730
|
+
|
|
1731
|
+
Never print, log, commit, or echo a real API key. Use \`YOUR_API_KEY\` in examples.
|
|
1732
|
+
|
|
1733
|
+
## TypeScript SDK
|
|
1734
|
+
|
|
1735
|
+
Install the official client when the runtime is JavaScript or TypeScript:
|
|
1736
|
+
|
|
1737
|
+
\`\`\`bash
|
|
1738
|
+
npm install @pdfvector/client
|
|
1739
|
+
\`\`\`
|
|
1740
|
+
|
|
1741
|
+
Create a client:
|
|
1742
|
+
|
|
1743
|
+
\`\`\`typescript
|
|
1744
|
+
import { createClient } from "@pdfvector/client";
|
|
1745
|
+
|
|
1746
|
+
const client = createClient({ apiKey: "YOUR_API_KEY" });
|
|
1747
|
+
\`\`\`
|
|
1748
|
+
|
|
1749
|
+
For custom or self-hosted instances, pass the instance domain:
|
|
1750
|
+
|
|
1751
|
+
\`\`\`typescript
|
|
1752
|
+
const client = createClient({
|
|
1753
|
+
domain: "global.pdfvector.com",
|
|
1754
|
+
apiKey: "YOUR_API_KEY",
|
|
1755
|
+
});
|
|
1756
|
+
\`\`\`
|
|
1757
|
+
|
|
1758
|
+
## Page-Separated Output
|
|
1759
|
+
|
|
1760
|
+
Set \`includePages: true\` when the caller needs page-separated markdown. PDF Vector still returns the full document in top-level \`markdown\`.
|
|
1761
|
+
|
|
1762
|
+
Relevant response fields:
|
|
1763
|
+
|
|
1764
|
+
- \`markdown\`: full parsed markdown for the document or paper.
|
|
1765
|
+
- \`pages\`: page-level markdown array, available when \`includePages\` is true.
|
|
1766
|
+
- \`pages[].pageNumber\`: 1-based page number.
|
|
1767
|
+
- \`pages[].markdown\`: markdown for that page.
|
|
1768
|
+
- \`pageCount\`: total pages.
|
|
1769
|
+
- \`model\`: model tier used.
|
|
1770
|
+
- \`credits\`: credits charged.
|
|
1771
|
+
- \`requestId\`: request identifier for support/debugging.
|
|
1772
|
+
- \`html\`: full HTML for Document Parse when using the \`max\` model.
|
|
1773
|
+
|
|
1774
|
+
## Credit Costs
|
|
1775
|
+
|
|
1776
|
+
${buildCreditCostsMarkdownTable()}
|
|
1777
|
+
|
|
1778
|
+
## Model Guidance
|
|
1779
|
+
|
|
1780
|
+
Use \`model: "auto"\` by default. Other model tiers are \`"nano"\`, \`"mini"\`, \`"pro"\`, and \`"max"\`.
|
|
1781
|
+
|
|
1782
|
+
Choose higher tiers when the document is complex, layout-heavy, or needs stronger extraction quality. Use \`max\` for Document Parse when the caller needs HTML output.
|
|
1783
|
+
|
|
1784
|
+
## Agent Workflow
|
|
1785
|
+
|
|
1786
|
+
1. Ask for or locate the PDF Vector API key without exposing it.
|
|
1787
|
+
2. Choose \`document.parse\` for direct documents or \`academic.parse\` for papers and publication IDs.
|
|
1788
|
+
3. Set \`includePages: true\` when the user asks for page-by-page output, citations by page, page summaries, or chunking by page.
|
|
1789
|
+
4. Return \`markdown\` for the full result and \`pages\` when the caller needs page-level content.
|
|
1790
|
+
5. Include \`requestId\` in debugging notes when a request fails.
|
|
1791
|
+
|
|
1792
|
+
## Public API Examples
|
|
1793
|
+
|
|
1794
|
+
${operations}
|
|
1795
|
+
|
|
1796
|
+
## Common Pitfalls
|
|
1797
|
+
|
|
1798
|
+
- Do not use a real API key in generated code samples.
|
|
1799
|
+
- Do not assume \`pages\` exists unless \`includePages\` was requested.
|
|
1800
|
+
- Do not rely only on \`pages\` when the caller needs the whole document; use top-level \`markdown\`.
|
|
1801
|
+
- For Academic Parse, do not invent metadata. Use returned fields such as \`title\`, \`doi\`, \`providerURL\`, and \`pdfURL\`.
|
|
1802
|
+
`;
|
|
1803
|
+
}
|