@pdfvector/instance-contract 0.2.7 → 0.2.9
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/index.d.ts +1 -11
- package/.tsc/lib/index.d.ts.map +1 -1
- package/.tsc/lib/index.js +1 -7
- package/CHANGELOG.md +23 -0
- package/package.json +6 -6
- package/.tsc/lib/fetchable-url-schema.d.ts +0 -3
- package/.tsc/lib/fetchable-url-schema.d.ts.map +0 -1
- package/.tsc/lib/fetchable-url-schema.js +0 -13
- package/.tsc/lib/json-schema-input.d.ts +0 -3
- package/.tsc/lib/json-schema-input.d.ts.map +0 -1
- package/.tsc/lib/json-schema-input.js +0 -25
- package/.tsc/lib/page-markdown-schema.d.ts +0 -6
- package/.tsc/lib/page-markdown-schema.d.ts.map +0 -1
- package/.tsc/lib/page-markdown-schema.js +0 -9
- package/.tsc/lib/pdfvector-model-schema.d.ts +0 -8
- package/.tsc/lib/pdfvector-model-schema.d.ts.map +0 -1
- package/.tsc/lib/pdfvector-model-schema.js +0 -4
- package/.tsc/lib/pdfvector-model.d.ts +0 -4
- package/.tsc/lib/pdfvector-model.d.ts.map +0 -1
- package/.tsc/lib/pdfvector-model.js +0 -0
- package/.tsc/lib/router/academic/fetch.d.ts +0 -69
- package/.tsc/lib/router/academic/fetch.d.ts.map +0 -1
- package/.tsc/lib/router/academic/fetch.js +0 -119
- package/.tsc/lib/router/academic/find-citations.d.ts +0 -70
- package/.tsc/lib/router/academic/find-citations.d.ts.map +0 -1
- package/.tsc/lib/router/academic/find-citations.js +0 -116
- package/.tsc/lib/router/academic/index.d.ts +0 -8
- package/.tsc/lib/router/academic/index.d.ts.map +0 -1
- package/.tsc/lib/router/academic/index.js +0 -7
- package/.tsc/lib/router/academic/paper-graph.d.ts +0 -113
- package/.tsc/lib/router/academic/paper-graph.d.ts.map +0 -1
- package/.tsc/lib/router/academic/paper-graph.js +0 -144
- package/.tsc/lib/router/academic/parse.d.ts +0 -50
- package/.tsc/lib/router/academic/parse.d.ts.map +0 -1
- package/.tsc/lib/router/academic/parse.js +0 -146
- package/.tsc/lib/router/academic/provider.d.ts +0 -18
- package/.tsc/lib/router/academic/provider.d.ts.map +0 -1
- package/.tsc/lib/router/academic/provider.js +0 -16
- package/.tsc/lib/router/academic/search-grants.d.ts +0 -84
- package/.tsc/lib/router/academic/search-grants.d.ts.map +0 -1
- package/.tsc/lib/router/academic/search-grants.js +0 -171
- package/.tsc/lib/router/academic/search.d.ts +0 -83
- package/.tsc/lib/router/academic/search.d.ts.map +0 -1
- package/.tsc/lib/router/academic/search.js +0 -154
- package/.tsc/lib/router/academic/similar-papers.d.ts +0 -89
- package/.tsc/lib/router/academic/similar-papers.d.ts.map +0 -1
- package/.tsc/lib/router/academic/similar-papers.js +0 -143
- package/.tsc/lib/router/admin/get-environment.d.ts +0 -5
- package/.tsc/lib/router/admin/get-environment.d.ts.map +0 -1
- package/.tsc/lib/router/admin/get-environment.js +0 -13
- package/.tsc/lib/router/admin/get-free-usage-records.d.ts +0 -34
- package/.tsc/lib/router/admin/get-free-usage-records.d.ts.map +0 -1
- package/.tsc/lib/router/admin/get-free-usage-records.js +0 -38
- package/.tsc/lib/router/admin/get-provider-usage-records.d.ts +0 -36
- package/.tsc/lib/router/admin/get-provider-usage-records.d.ts.map +0 -1
- package/.tsc/lib/router/admin/get-provider-usage-records.js +0 -45
- package/.tsc/lib/router/admin/get-usage-records.d.ts +0 -48
- package/.tsc/lib/router/admin/get-usage-records.d.ts.map +0 -1
- package/.tsc/lib/router/admin/get-usage-records.js +0 -44
- package/.tsc/lib/router/admin/health-check.d.ts +0 -5
- package/.tsc/lib/router/admin/health-check.d.ts.map +0 -1
- package/.tsc/lib/router/admin/health-check.js +0 -14
- package/.tsc/lib/router/admin/index.d.ts +0 -9
- package/.tsc/lib/router/admin/index.d.ts.map +0 -1
- package/.tsc/lib/router/admin/index.js +0 -8
- package/.tsc/lib/router/admin/set-domain.d.ts +0 -7
- package/.tsc/lib/router/admin/set-domain.d.ts.map +0 -1
- package/.tsc/lib/router/admin/set-domain.js +0 -20
- package/.tsc/lib/router/admin/set-environment.d.ts +0 -7
- package/.tsc/lib/router/admin/set-environment.d.ts.map +0 -1
- package/.tsc/lib/router/admin/set-environment.js +0 -41
- package/.tsc/lib/router/admin/set-version.d.ts +0 -7
- package/.tsc/lib/router/admin/set-version.d.ts.map +0 -1
- package/.tsc/lib/router/admin/set-version.js +0 -21
- package/.tsc/lib/router/authenticate/index.d.ts +0 -2
- package/.tsc/lib/router/authenticate/index.d.ts.map +0 -1
- package/.tsc/lib/router/authenticate/index.js +0 -1
- package/.tsc/lib/router/authenticate/validate-credential.d.ts +0 -7
- package/.tsc/lib/router/authenticate/validate-credential.d.ts.map +0 -1
- package/.tsc/lib/router/authenticate/validate-credential.js +0 -20
- package/.tsc/lib/router/bankStatement/ask.d.ts +0 -32
- package/.tsc/lib/router/bankStatement/ask.d.ts.map +0 -1
- package/.tsc/lib/router/bankStatement/ask.js +0 -88
- package/.tsc/lib/router/bankStatement/extract.d.ts +0 -33
- package/.tsc/lib/router/bankStatement/extract.d.ts.map +0 -1
- package/.tsc/lib/router/bankStatement/extract.js +0 -113
- package/.tsc/lib/router/bankStatement/get-default-spec.d.ts +0 -2
- package/.tsc/lib/router/bankStatement/get-default-spec.d.ts.map +0 -1
- package/.tsc/lib/router/bankStatement/get-default-spec.js +0 -19
- package/.tsc/lib/router/bankStatement/index.d.ts +0 -4
- package/.tsc/lib/router/bankStatement/index.d.ts.map +0 -1
- package/.tsc/lib/router/bankStatement/index.js +0 -3
- package/.tsc/lib/router/bankStatement/parse.d.ts +0 -28
- package/.tsc/lib/router/bankStatement/parse.d.ts.map +0 -1
- package/.tsc/lib/router/bankStatement/parse.js +0 -105
- package/.tsc/lib/router/document/ask.d.ts +0 -32
- package/.tsc/lib/router/document/ask.d.ts.map +0 -1
- package/.tsc/lib/router/document/ask.js +0 -134
- package/.tsc/lib/router/document/extract.d.ts +0 -33
- package/.tsc/lib/router/document/extract.d.ts.map +0 -1
- package/.tsc/lib/router/document/extract.js +0 -152
- package/.tsc/lib/router/document/get-default-spec.d.ts +0 -2
- package/.tsc/lib/router/document/get-default-spec.d.ts.map +0 -1
- package/.tsc/lib/router/document/get-default-spec.js +0 -19
- package/.tsc/lib/router/document/index.d.ts +0 -4
- package/.tsc/lib/router/document/index.d.ts.map +0 -1
- package/.tsc/lib/router/document/index.js +0 -3
- package/.tsc/lib/router/document/parse.d.ts +0 -40
- package/.tsc/lib/router/document/parse.d.ts.map +0 -1
- package/.tsc/lib/router/document/parse.js +0 -142
- package/.tsc/lib/router/free/bank-statement-parse.d.ts +0 -16
- package/.tsc/lib/router/free/bank-statement-parse.d.ts.map +0 -1
- package/.tsc/lib/router/free/bank-statement-parse.js +0 -87
- package/.tsc/lib/router/free/generate-schema.d.ts +0 -8
- package/.tsc/lib/router/free/generate-schema.d.ts.map +0 -1
- package/.tsc/lib/router/free/generate-schema.js +0 -110
- package/.tsc/lib/router/free/index.d.ts +0 -5
- package/.tsc/lib/router/free/index.d.ts.map +0 -1
- package/.tsc/lib/router/free/index.js +0 -4
- package/.tsc/lib/router/free/publication-pdf-url.d.ts +0 -12
- package/.tsc/lib/router/free/publication-pdf-url.d.ts.map +0 -1
- package/.tsc/lib/router/free/publication-pdf-url.js +0 -86
- package/.tsc/lib/router/free/rate-limit-status.d.ts +0 -19
- package/.tsc/lib/router/free/rate-limit-status.d.ts.map +0 -1
- package/.tsc/lib/router/free/rate-limit-status.js +0 -36
- package/.tsc/lib/router/identity/ask.d.ts +0 -32
- package/.tsc/lib/router/identity/ask.d.ts.map +0 -1
- package/.tsc/lib/router/identity/ask.js +0 -95
- package/.tsc/lib/router/identity/extract.d.ts +0 -33
- package/.tsc/lib/router/identity/extract.d.ts.map +0 -1
- package/.tsc/lib/router/identity/extract.js +0 -103
- package/.tsc/lib/router/identity/get-default-spec.d.ts +0 -2
- package/.tsc/lib/router/identity/get-default-spec.d.ts.map +0 -1
- package/.tsc/lib/router/identity/get-default-spec.js +0 -19
- package/.tsc/lib/router/identity/index.d.ts +0 -4
- package/.tsc/lib/router/identity/index.d.ts.map +0 -1
- package/.tsc/lib/router/identity/index.js +0 -3
- package/.tsc/lib/router/identity/parse.d.ts +0 -29
- package/.tsc/lib/router/identity/parse.d.ts.map +0 -1
- package/.tsc/lib/router/identity/parse.js +0 -109
- package/.tsc/lib/router/index.d.ts +0 -9
- package/.tsc/lib/router/index.d.ts.map +0 -1
- package/.tsc/lib/router/index.js +0 -8
- package/.tsc/lib/router/invoice/ask.d.ts +0 -32
- package/.tsc/lib/router/invoice/ask.d.ts.map +0 -1
- package/.tsc/lib/router/invoice/ask.js +0 -85
- package/.tsc/lib/router/invoice/extract.d.ts +0 -33
- package/.tsc/lib/router/invoice/extract.d.ts.map +0 -1
- package/.tsc/lib/router/invoice/extract.js +0 -109
- package/.tsc/lib/router/invoice/get-default-spec.d.ts +0 -2
- package/.tsc/lib/router/invoice/get-default-spec.d.ts.map +0 -1
- package/.tsc/lib/router/invoice/get-default-spec.js +0 -19
- package/.tsc/lib/router/invoice/index.d.ts +0 -4
- package/.tsc/lib/router/invoice/index.d.ts.map +0 -1
- package/.tsc/lib/router/invoice/index.js +0 -3
- package/.tsc/lib/router/invoice/parse.d.ts +0 -28
- package/.tsc/lib/router/invoice/parse.d.ts.map +0 -1
- package/.tsc/lib/router/invoice/parse.js +0 -100
- package/.tsc/lib/supported-mimes.d.ts +0 -35
- package/.tsc/lib/supported-mimes.d.ts.map +0 -1
- package/.tsc/lib/supported-mimes.js +0 -130
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
-
url: z.ZodOptional<z.ZodURL>;
|
|
4
|
-
file: z.ZodOptional<z.ZodFile>;
|
|
5
|
-
base64: z.ZodOptional<z.ZodString>;
|
|
6
|
-
question: z.ZodString;
|
|
7
|
-
model: z.ZodDefault<z.ZodEnum<{
|
|
8
|
-
auto: "auto";
|
|
9
|
-
max: "max";
|
|
10
|
-
mini: "mini";
|
|
11
|
-
nano: "nano";
|
|
12
|
-
pro: "pro";
|
|
13
|
-
}>>;
|
|
14
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
15
|
-
callback: z.ZodOptional<z.ZodObject<{
|
|
16
|
-
url: z.ZodURL;
|
|
17
|
-
type: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, z.core.$strip>>;
|
|
19
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
-
markdown: z.ZodString;
|
|
21
|
-
pageCount: z.ZodNumber;
|
|
22
|
-
model: z.ZodEnum<{
|
|
23
|
-
max: "max";
|
|
24
|
-
mini: "mini";
|
|
25
|
-
nano: "nano";
|
|
26
|
-
pro: "pro";
|
|
27
|
-
}>;
|
|
28
|
-
credits: z.ZodNumber;
|
|
29
|
-
requestId: z.ZodNumber;
|
|
30
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
31
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
32
|
-
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../../../lib/router/identity/ask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyGxB,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAYS,CAAC"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import { getOpenApiCodeSamples } from "@pdfvector/api-docs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { fetchableUrlSchema } from "../../fetchable-url-schema.js";
|
|
5
|
-
import { pdfvectorModelSchema } from "../../pdfvector-model-schema.js";
|
|
6
|
-
import { outputAskModelDescription, specializedAskModelDescription, supportedFileFormatsDescription, supportedFileMimeErrorMessage, supportedFileMimes, supportedFileTypesLong, } from "../../supported-mimes.js";
|
|
7
|
-
import { getDefaultSpec } from "./get-default-spec.js";
|
|
8
|
-
const specializedModelSchema = z
|
|
9
|
-
.enum(["auto", ...pdfvectorModelSchema.options])
|
|
10
|
-
.default("auto");
|
|
11
|
-
const askInputSchema = z.object({
|
|
12
|
-
url: fetchableUrlSchema
|
|
13
|
-
.optional()
|
|
14
|
-
.describe("URL of the identity document file to fetch and parse"),
|
|
15
|
-
file: z
|
|
16
|
-
.file()
|
|
17
|
-
.mime([...supportedFileMimes], supportedFileMimeErrorMessage)
|
|
18
|
-
.optional()
|
|
19
|
-
.describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
|
|
20
|
-
base64: z
|
|
21
|
-
.string()
|
|
22
|
-
.optional()
|
|
23
|
-
.describe("Base64-encoded identity document file content"),
|
|
24
|
-
question: z
|
|
25
|
-
.string()
|
|
26
|
-
.min(4, "question must be at least 4 characters")
|
|
27
|
-
.describe("The question to answer about the identity document"),
|
|
28
|
-
model: specializedModelSchema.describe(specializedAskModelDescription),
|
|
29
|
-
documentId: z
|
|
30
|
-
.string()
|
|
31
|
-
.trim()
|
|
32
|
-
.min(1)
|
|
33
|
-
.max(512)
|
|
34
|
-
.optional()
|
|
35
|
-
.describe("Optional external document ID for usage attribution. The x-pdfvector-document-id header takes precedence when both are provided."),
|
|
36
|
-
callback: z
|
|
37
|
-
.object({
|
|
38
|
-
url: fetchableUrlSchema.describe("Webhook URL where results will be POSTed when processing completes"),
|
|
39
|
-
type: z
|
|
40
|
-
.string()
|
|
41
|
-
.optional()
|
|
42
|
-
.describe("Callback type identifier (e.g. 'zapier')"),
|
|
43
|
-
})
|
|
44
|
-
.optional()
|
|
45
|
-
.describe("Optional webhook callback for async processing. " +
|
|
46
|
-
"When provided, the server returns 202 immediately and POSTs the full response payload to the callback URL when processing completes. " +
|
|
47
|
-
"On error, the callback receives a POST with X-Pdfvector-Callback-Failed: true header and error details in the body. " +
|
|
48
|
-
"Useful for long-running operations that may exceed client timeout limits."),
|
|
49
|
-
});
|
|
50
|
-
const askOutputSchema = z.object({
|
|
51
|
-
markdown: z.string().describe("The answer to the question"),
|
|
52
|
-
pageCount: z.number().int().describe("Total number of pages in the document"),
|
|
53
|
-
model: pdfvectorModelSchema.describe(outputAskModelDescription),
|
|
54
|
-
credits: z
|
|
55
|
-
.number()
|
|
56
|
-
.int()
|
|
57
|
-
.describe("Number of credits consumed by this API call. Cost per page: nano=6, mini=10, pro=14, max=18."),
|
|
58
|
-
requestId: z
|
|
59
|
-
.number()
|
|
60
|
-
.int()
|
|
61
|
-
.describe("Unique request identifier for this API call"),
|
|
62
|
-
documentId: z
|
|
63
|
-
.string()
|
|
64
|
-
.optional()
|
|
65
|
-
.describe("Document ID if provided via x-pdfvector-document-id header or request body"),
|
|
66
|
-
});
|
|
67
|
-
const requestExamples = {
|
|
68
|
-
"Ask from URL": {
|
|
69
|
-
summary: "Ask from URL",
|
|
70
|
-
value: {
|
|
71
|
-
url: "https://example.com/identity-document.pdf",
|
|
72
|
-
question: "What is the name on this identity document?",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
"Ask from base64": {
|
|
76
|
-
summary: "Ask from base64",
|
|
77
|
-
value: {
|
|
78
|
-
base64: "JVBERi0xLjAKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqIDIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iaiAzIDAgb2JqPDwvVHlwZS9QYWdlL01lZGlhQm94WzAgMCAzIDNdL1BhcmVudCAyIDAgUj4+ZW5kb2JqCnhyZWYKMCA0CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKdHJhaWxlcjw8L1NpemUgNC9Sb290IDEgMCBSPj4Kc3RhcnR4cmVmCjE5MAolJUVPRg==",
|
|
79
|
-
question: "What is the document number?",
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
export const ask = oc
|
|
84
|
-
.route({
|
|
85
|
-
summary: "Ask a question about an identity document",
|
|
86
|
-
description: `Parse an identity document 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.`,
|
|
87
|
-
tags: ["Identity"],
|
|
88
|
-
spec: (op) => {
|
|
89
|
-
const spec = getDefaultSpec(op, requestExamples);
|
|
90
|
-
spec["x-codeSamples"] = getOpenApiCodeSamples("identity-ask");
|
|
91
|
-
return spec;
|
|
92
|
-
},
|
|
93
|
-
})
|
|
94
|
-
.input(askInputSchema)
|
|
95
|
-
.output(askOutputSchema);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const extract: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
-
url: z.ZodOptional<z.ZodURL>;
|
|
4
|
-
file: z.ZodOptional<z.ZodFile>;
|
|
5
|
-
base64: z.ZodOptional<z.ZodString>;
|
|
6
|
-
prompt: z.ZodString;
|
|
7
|
-
schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
|
|
8
|
-
model: z.ZodDefault<z.ZodEnum<{
|
|
9
|
-
auto: "auto";
|
|
10
|
-
max: "max";
|
|
11
|
-
mini: "mini";
|
|
12
|
-
nano: "nano";
|
|
13
|
-
pro: "pro";
|
|
14
|
-
}>>;
|
|
15
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
16
|
-
callback: z.ZodOptional<z.ZodObject<{
|
|
17
|
-
url: z.ZodURL;
|
|
18
|
-
type: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strip>>;
|
|
20
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
-
data: z.ZodUnknown;
|
|
22
|
-
pageCount: z.ZodNumber;
|
|
23
|
-
model: z.ZodEnum<{
|
|
24
|
-
max: "max";
|
|
25
|
-
mini: "mini";
|
|
26
|
-
nano: "nano";
|
|
27
|
-
pro: "pro";
|
|
28
|
-
}>;
|
|
29
|
-
credits: z.ZodNumber;
|
|
30
|
-
requestId: z.ZodNumber;
|
|
31
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
32
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
33
|
-
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../lib/router/identity/extract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwHxB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAYS,CAAC"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import { getOpenApiCodeSamples } from "@pdfvector/api-docs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { fetchableUrlSchema } from "../../fetchable-url-schema.js";
|
|
5
|
-
import { jsonSchemaInput } from "../../json-schema-input.js";
|
|
6
|
-
import { pdfvectorModelSchema } from "../../pdfvector-model-schema.js";
|
|
7
|
-
import { outputExtractModelDescription, specializedExtractModelDescription, supportedFileFormatsDescription, supportedFileMimeErrorMessage, supportedFileMimes, supportedFileTypesLong, } from "../../supported-mimes.js";
|
|
8
|
-
import { getDefaultSpec } from "./get-default-spec.js";
|
|
9
|
-
const specializedModelSchema = z
|
|
10
|
-
.enum(["auto", ...pdfvectorModelSchema.options])
|
|
11
|
-
.default("auto");
|
|
12
|
-
const extractInputSchema = z.object({
|
|
13
|
-
url: fetchableUrlSchema
|
|
14
|
-
.optional()
|
|
15
|
-
.describe("URL of the identity document file to fetch and parse"),
|
|
16
|
-
file: z
|
|
17
|
-
.file()
|
|
18
|
-
.mime([...supportedFileMimes], supportedFileMimeErrorMessage)
|
|
19
|
-
.optional()
|
|
20
|
-
.describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
|
|
21
|
-
base64: z
|
|
22
|
-
.string()
|
|
23
|
-
.optional()
|
|
24
|
-
.describe("Base64-encoded identity document file content"),
|
|
25
|
-
prompt: z
|
|
26
|
-
.string()
|
|
27
|
-
.min(4, "prompt must be at least 4 characters")
|
|
28
|
-
.describe("The prompt instructing the AI how to extract data from the identity document"),
|
|
29
|
-
schema: jsonSchemaInput.describe("JSON Schema describing the structure of the data to extract from the identity document. Can be a JSON object or a JSON string."),
|
|
30
|
-
model: specializedModelSchema.describe(specializedExtractModelDescription),
|
|
31
|
-
documentId: z
|
|
32
|
-
.string()
|
|
33
|
-
.trim()
|
|
34
|
-
.min(1)
|
|
35
|
-
.max(512)
|
|
36
|
-
.optional()
|
|
37
|
-
.describe("Optional external document ID for usage attribution. The x-pdfvector-document-id header takes precedence when both are provided."),
|
|
38
|
-
callback: z
|
|
39
|
-
.object({
|
|
40
|
-
url: fetchableUrlSchema.describe("Webhook URL where results will be POSTed when processing completes"),
|
|
41
|
-
type: z
|
|
42
|
-
.string()
|
|
43
|
-
.optional()
|
|
44
|
-
.describe("Callback type identifier (e.g. 'zapier')"),
|
|
45
|
-
})
|
|
46
|
-
.optional()
|
|
47
|
-
.describe("Optional webhook callback for async processing. " +
|
|
48
|
-
"When provided, the server returns 202 immediately and POSTs the full response payload to the callback URL when processing completes. " +
|
|
49
|
-
"On error, the callback receives a POST with X-Pdfvector-Callback-Failed: true header and error details in the body. " +
|
|
50
|
-
"Useful for long-running operations that may exceed client timeout limits."),
|
|
51
|
-
});
|
|
52
|
-
const extractOutputSchema = z.object({
|
|
53
|
-
data: z
|
|
54
|
-
.unknown()
|
|
55
|
-
.refine((val) => val != null &&
|
|
56
|
-
(typeof val !== "object" || Object.keys(val).length > 0), { message: "Extracted data must not be empty" })
|
|
57
|
-
.describe("Extracted structured data matching the provided JSON Schema"),
|
|
58
|
-
pageCount: z.number().int().describe("Total number of pages in the document"),
|
|
59
|
-
model: pdfvectorModelSchema.describe(outputExtractModelDescription),
|
|
60
|
-
credits: z
|
|
61
|
-
.number()
|
|
62
|
-
.int()
|
|
63
|
-
.describe("Number of credits consumed by this API call. Cost per page: nano=6, mini=10, pro=14, max=18."),
|
|
64
|
-
requestId: z
|
|
65
|
-
.number()
|
|
66
|
-
.int()
|
|
67
|
-
.describe("Unique request identifier for this API call"),
|
|
68
|
-
documentId: z
|
|
69
|
-
.string()
|
|
70
|
-
.optional()
|
|
71
|
-
.describe("Document ID if provided via x-pdfvector-document-id header or request body"),
|
|
72
|
-
});
|
|
73
|
-
const requestExamples = {
|
|
74
|
-
"Extract from URL": {
|
|
75
|
-
summary: "Extract from URL",
|
|
76
|
-
value: {
|
|
77
|
-
url: "https://example.com/identity-document.pdf",
|
|
78
|
-
prompt: "Extract the name, date of birth, and document number",
|
|
79
|
-
schema: JSON.stringify({
|
|
80
|
-
type: "object",
|
|
81
|
-
properties: {
|
|
82
|
-
name: { type: "string" },
|
|
83
|
-
dateOfBirth: { type: "string" },
|
|
84
|
-
documentNumber: { type: "string" },
|
|
85
|
-
},
|
|
86
|
-
required: ["name", "dateOfBirth", "documentNumber"],
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
export const extract = oc
|
|
92
|
-
.route({
|
|
93
|
-
summary: "Extract structured data from an identity document",
|
|
94
|
-
description: `Parse an identity document 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.`,
|
|
95
|
-
tags: ["Identity"],
|
|
96
|
-
spec: (op) => {
|
|
97
|
-
const spec = getDefaultSpec(op, requestExamples);
|
|
98
|
-
spec["x-codeSamples"] = getOpenApiCodeSamples("identity-extract");
|
|
99
|
-
return spec;
|
|
100
|
-
},
|
|
101
|
-
})
|
|
102
|
-
.input(extractInputSchema)
|
|
103
|
-
.output(extractOutputSchema);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-spec.d.ts","sourceRoot":"","sources":["../../../../lib/router/identity/get-default-spec.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAC7B,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACtC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export function getDefaultSpec(op, requestExamples) {
|
|
2
|
-
op["security"] = [{ bearerAuth: [] }];
|
|
3
|
-
const params = (op["parameters"] ?? []);
|
|
4
|
-
params.push({
|
|
5
|
-
name: "x-pdfvector-document-id",
|
|
6
|
-
in: "header",
|
|
7
|
-
required: false,
|
|
8
|
-
schema: { type: "string", default: "my-doc-123" },
|
|
9
|
-
description: "Optional document ID to associate with this request. Returned in the response and saved for usage tracking.",
|
|
10
|
-
});
|
|
11
|
-
op["parameters"] = params;
|
|
12
|
-
const reqBody = op["requestBody"];
|
|
13
|
-
if (reqBody?.content) {
|
|
14
|
-
for (const mediaType of Object.values(reqBody.content)) {
|
|
15
|
-
mediaType["examples"] = requestExamples;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return op;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/router/identity/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const parse: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
-
url: z.ZodOptional<z.ZodURL>;
|
|
4
|
-
file: z.ZodOptional<z.ZodFile>;
|
|
5
|
-
base64: z.ZodOptional<z.ZodString>;
|
|
6
|
-
model: z.ZodDefault<z.ZodEnum<{
|
|
7
|
-
auto: "auto";
|
|
8
|
-
max: "max";
|
|
9
|
-
pro: "pro";
|
|
10
|
-
}>>;
|
|
11
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
12
|
-
callback: z.ZodOptional<z.ZodObject<{
|
|
13
|
-
url: z.ZodURL;
|
|
14
|
-
type: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
-
markdown: z.ZodString;
|
|
18
|
-
pageCount: z.ZodNumber;
|
|
19
|
-
model: z.ZodEnum<{
|
|
20
|
-
max: "max";
|
|
21
|
-
pro: "pro";
|
|
22
|
-
}>;
|
|
23
|
-
documentType: z.ZodOptional<z.ZodString>;
|
|
24
|
-
html: z.ZodOptional<z.ZodString>;
|
|
25
|
-
credits: z.ZodNumber;
|
|
26
|
-
requestId: z.ZodNumber;
|
|
27
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
29
|
-
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../lib/router/identity/parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4HxB,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;8DAYS,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import { getOpenApiCodeSamples } from "@pdfvector/api-docs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { fetchableUrlSchema } from "../../fetchable-url-schema.js";
|
|
5
|
-
import { specializedParseModelDescription, supportedFileFormatsDescription, supportedFileMimeErrorMessage, supportedFileMimes, supportedFileTypesLong, } from "../../supported-mimes.js";
|
|
6
|
-
import { getDefaultSpec } from "./get-default-spec.js";
|
|
7
|
-
const specializedParseModelSchema = z
|
|
8
|
-
.enum(["pro", "max", "auto"], {
|
|
9
|
-
message: "model must be one of: pro, max, auto",
|
|
10
|
-
})
|
|
11
|
-
.default("auto");
|
|
12
|
-
const parseInputSchema = z.object({
|
|
13
|
-
url: fetchableUrlSchema
|
|
14
|
-
.optional()
|
|
15
|
-
.describe("URL of the identity document file to fetch and parse"),
|
|
16
|
-
file: z
|
|
17
|
-
.file()
|
|
18
|
-
.mime([...supportedFileMimes], supportedFileMimeErrorMessage)
|
|
19
|
-
.optional()
|
|
20
|
-
.describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
|
|
21
|
-
base64: z
|
|
22
|
-
.string()
|
|
23
|
-
.optional()
|
|
24
|
-
.describe("Base64-encoded identity document file content"),
|
|
25
|
-
model: specializedParseModelSchema.describe(specializedParseModelDescription("identity document")),
|
|
26
|
-
documentId: z
|
|
27
|
-
.string()
|
|
28
|
-
.trim()
|
|
29
|
-
.min(1)
|
|
30
|
-
.max(512)
|
|
31
|
-
.optional()
|
|
32
|
-
.describe("Optional external document ID for usage attribution. The x-pdfvector-document-id header takes precedence when both are provided."),
|
|
33
|
-
callback: z
|
|
34
|
-
.object({
|
|
35
|
-
url: fetchableUrlSchema.describe("Webhook URL where results will be POSTed when processing completes"),
|
|
36
|
-
type: z
|
|
37
|
-
.string()
|
|
38
|
-
.optional()
|
|
39
|
-
.describe("Callback type identifier (e.g. 'zapier')"),
|
|
40
|
-
})
|
|
41
|
-
.optional()
|
|
42
|
-
.describe("Optional webhook callback for async processing. " +
|
|
43
|
-
"When provided, the server returns 202 immediately and POSTs the full response payload to the callback URL when processing completes. " +
|
|
44
|
-
"On error, the callback receives a POST with X-Pdfvector-Callback-Failed: true header and error details in the body. " +
|
|
45
|
-
"Useful for long-running operations that may exceed client timeout limits."),
|
|
46
|
-
});
|
|
47
|
-
const parseOutputSchema = z.object({
|
|
48
|
-
markdown: z
|
|
49
|
-
.string()
|
|
50
|
-
.describe("Extracted text content from the identity document"),
|
|
51
|
-
pageCount: z.number().int().describe("Total number of pages in the document"),
|
|
52
|
-
model: z
|
|
53
|
-
.enum(["pro", "max"])
|
|
54
|
-
.describe("Model tier used to parse the identity document"),
|
|
55
|
-
documentType: z
|
|
56
|
-
.string()
|
|
57
|
-
.optional()
|
|
58
|
-
.describe("Detected identity document type (e.g., passport, driver's license)"),
|
|
59
|
-
html: z
|
|
60
|
-
.string()
|
|
61
|
-
.optional()
|
|
62
|
-
.describe("Full HTML representation of the document content. Only available when using the 'max' model. " +
|
|
63
|
-
"Preserves rich formatting, tables, selection marks, and visual layout that cannot be fully represented in markdown."),
|
|
64
|
-
credits: z
|
|
65
|
-
.number()
|
|
66
|
-
.int()
|
|
67
|
-
.describe("Number of credits consumed by this API call. Cost per page: pro=6, max=10."),
|
|
68
|
-
requestId: z
|
|
69
|
-
.number()
|
|
70
|
-
.int()
|
|
71
|
-
.describe("Unique request identifier for this API call"),
|
|
72
|
-
documentId: z
|
|
73
|
-
.string()
|
|
74
|
-
.optional()
|
|
75
|
-
.describe("Document ID if provided via x-pdfvector-document-id header or request body"),
|
|
76
|
-
});
|
|
77
|
-
const requestExamples = {
|
|
78
|
-
"Parse from URL": {
|
|
79
|
-
summary: "Parse from URL",
|
|
80
|
-
value: {
|
|
81
|
-
url: "https://example.com/identity-document.pdf",
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
"Parse from base64": {
|
|
85
|
-
summary: "Parse from base64",
|
|
86
|
-
value: {
|
|
87
|
-
base64: "JVBERi0xLjAKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqIDIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iaiAzIDAgb2JqPDwvVHlwZS9QYWdlL01lZGlhQm94WzAgMCAzIDNdL1BhcmVudCAyIDAgUj4+ZW5kb2JqCnhyZWYKMCA0CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKdHJhaWxlcjw8L1NpemUgNC9Sb290IDEgMCBSPj4Kc3RhcnR4cmVmCjE5MAolJUVPRg==",
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
"Parse from file upload": {
|
|
91
|
-
summary: "Parse from file upload",
|
|
92
|
-
value: {
|
|
93
|
-
file: "(binary)",
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
export const parse = oc
|
|
98
|
-
.route({
|
|
99
|
-
summary: "Parse an identity document",
|
|
100
|
-
description: `Extract text and structured data from an identity document. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string.`,
|
|
101
|
-
tags: ["Identity"],
|
|
102
|
-
spec: (op) => {
|
|
103
|
-
const spec = getDefaultSpec(op, requestExamples);
|
|
104
|
-
spec["x-codeSamples"] = getOpenApiCodeSamples("identity-parse");
|
|
105
|
-
return spec;
|
|
106
|
-
},
|
|
107
|
-
})
|
|
108
|
-
.input(parseInputSchema)
|
|
109
|
-
.output(parseOutputSchema);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * as academic from "./academic/index.js";
|
|
2
|
-
export * as admin from "./admin/index.js";
|
|
3
|
-
export * as authenticate from "./authenticate/index.js";
|
|
4
|
-
export * as bankStatement from "./bankStatement/index.js";
|
|
5
|
-
export * as document from "./document/index.js";
|
|
6
|
-
export * as free from "./free/index.js";
|
|
7
|
-
export * as identity from "./identity/index.js";
|
|
8
|
-
export * as invoice from "./invoice/index.js";
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
|
package/.tsc/lib/router/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * as academic from "./academic/index.js";
|
|
2
|
-
export * as admin from "./admin/index.js";
|
|
3
|
-
export * as authenticate from "./authenticate/index.js";
|
|
4
|
-
export * as bankStatement from "./bankStatement/index.js";
|
|
5
|
-
export * as document from "./document/index.js";
|
|
6
|
-
export * as free from "./free/index.js";
|
|
7
|
-
export * as identity from "./identity/index.js";
|
|
8
|
-
export * as invoice from "./invoice/index.js";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
-
url: z.ZodOptional<z.ZodURL>;
|
|
4
|
-
file: z.ZodOptional<z.ZodFile>;
|
|
5
|
-
base64: z.ZodOptional<z.ZodString>;
|
|
6
|
-
question: z.ZodString;
|
|
7
|
-
model: z.ZodDefault<z.ZodEnum<{
|
|
8
|
-
auto: "auto";
|
|
9
|
-
max: "max";
|
|
10
|
-
mini: "mini";
|
|
11
|
-
nano: "nano";
|
|
12
|
-
pro: "pro";
|
|
13
|
-
}>>;
|
|
14
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
15
|
-
callback: z.ZodOptional<z.ZodObject<{
|
|
16
|
-
url: z.ZodURL;
|
|
17
|
-
type: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, z.core.$strip>>;
|
|
19
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
-
markdown: z.ZodString;
|
|
21
|
-
pageCount: z.ZodNumber;
|
|
22
|
-
model: z.ZodEnum<{
|
|
23
|
-
max: "max";
|
|
24
|
-
mini: "mini";
|
|
25
|
-
nano: "nano";
|
|
26
|
-
pro: "pro";
|
|
27
|
-
}>;
|
|
28
|
-
credits: z.ZodNumber;
|
|
29
|
-
requestId: z.ZodNumber;
|
|
30
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
31
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
32
|
-
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../../../lib/router/invoice/ask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8FxB,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAYS,CAAC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import { getOpenApiCodeSamples } from "@pdfvector/api-docs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { fetchableUrlSchema } from "../../fetchable-url-schema.js";
|
|
5
|
-
import { pdfvectorModelSchema } from "../../pdfvector-model-schema.js";
|
|
6
|
-
import { outputAskModelDescription, specializedAskModelDescription, supportedFileFormatsDescription, supportedFileMimeErrorMessage, supportedFileMimes, supportedFileTypesLong, } from "../../supported-mimes.js";
|
|
7
|
-
import { getDefaultSpec } from "./get-default-spec.js";
|
|
8
|
-
const specializedModelSchema = z
|
|
9
|
-
.enum(["auto", ...pdfvectorModelSchema.options])
|
|
10
|
-
.default("auto");
|
|
11
|
-
const askInputSchema = z.object({
|
|
12
|
-
url: fetchableUrlSchema
|
|
13
|
-
.optional()
|
|
14
|
-
.describe("URL of the invoice file to fetch and parse"),
|
|
15
|
-
file: z
|
|
16
|
-
.file()
|
|
17
|
-
.mime([...supportedFileMimes], supportedFileMimeErrorMessage)
|
|
18
|
-
.optional()
|
|
19
|
-
.describe(`Invoice file upload via multipart form-data (${supportedFileFormatsDescription})`),
|
|
20
|
-
base64: z.string().optional().describe("Base64-encoded invoice file content"),
|
|
21
|
-
question: z
|
|
22
|
-
.string()
|
|
23
|
-
.min(4, "question must be at least 4 characters")
|
|
24
|
-
.describe("The question to answer about the invoice"),
|
|
25
|
-
model: specializedModelSchema.describe(specializedAskModelDescription),
|
|
26
|
-
documentId: z
|
|
27
|
-
.string()
|
|
28
|
-
.trim()
|
|
29
|
-
.min(1)
|
|
30
|
-
.max(512)
|
|
31
|
-
.optional()
|
|
32
|
-
.describe("Optional external document ID for usage attribution. The x-pdfvector-document-id header takes precedence when both are provided."),
|
|
33
|
-
callback: z
|
|
34
|
-
.object({
|
|
35
|
-
url: fetchableUrlSchema.describe("Webhook URL where results will be POSTed when processing completes"),
|
|
36
|
-
type: z
|
|
37
|
-
.string()
|
|
38
|
-
.optional()
|
|
39
|
-
.describe("Callback type identifier (e.g. 'zapier')"),
|
|
40
|
-
})
|
|
41
|
-
.optional()
|
|
42
|
-
.describe("Optional webhook callback for async processing. " +
|
|
43
|
-
"When provided, the server returns 202 immediately and POSTs the full response payload to the callback URL when processing completes. " +
|
|
44
|
-
"On error, the callback receives a POST with X-Pdfvector-Callback-Failed: true header and error details in the body. " +
|
|
45
|
-
"Useful for long-running operations that may exceed client timeout limits."),
|
|
46
|
-
});
|
|
47
|
-
const askOutputSchema = z.object({
|
|
48
|
-
markdown: z.string().describe("The answer to the question"),
|
|
49
|
-
pageCount: z.number().int().describe("Total number of pages in the document"),
|
|
50
|
-
model: pdfvectorModelSchema.describe(outputAskModelDescription),
|
|
51
|
-
credits: z
|
|
52
|
-
.number()
|
|
53
|
-
.int()
|
|
54
|
-
.describe("Number of credits consumed by this API call. Cost per page: nano=6, mini=10, pro=14, max=18."),
|
|
55
|
-
requestId: z
|
|
56
|
-
.number()
|
|
57
|
-
.int()
|
|
58
|
-
.describe("Unique request identifier for this API call"),
|
|
59
|
-
documentId: z
|
|
60
|
-
.string()
|
|
61
|
-
.optional()
|
|
62
|
-
.describe("Document ID if provided via x-pdfvector-document-id header or request body"),
|
|
63
|
-
});
|
|
64
|
-
const requestExamples = {
|
|
65
|
-
"Ask from URL": {
|
|
66
|
-
summary: "Ask from URL",
|
|
67
|
-
value: {
|
|
68
|
-
url: "https://example.com/invoice.pdf",
|
|
69
|
-
question: "What is the total amount on this invoice?",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
export const ask = oc
|
|
74
|
-
.route({
|
|
75
|
-
summary: "Ask a question about an invoice",
|
|
76
|
-
description: `Parse an invoice 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.`,
|
|
77
|
-
tags: ["Invoice"],
|
|
78
|
-
spec: (op) => {
|
|
79
|
-
const spec = getDefaultSpec(op, requestExamples);
|
|
80
|
-
spec["x-codeSamples"] = getOpenApiCodeSamples("invoice-ask");
|
|
81
|
-
return spec;
|
|
82
|
-
},
|
|
83
|
-
})
|
|
84
|
-
.input(askInputSchema)
|
|
85
|
-
.output(askOutputSchema);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const extract: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
-
url: z.ZodOptional<z.ZodURL>;
|
|
4
|
-
file: z.ZodOptional<z.ZodFile>;
|
|
5
|
-
base64: z.ZodOptional<z.ZodString>;
|
|
6
|
-
prompt: z.ZodString;
|
|
7
|
-
schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
|
|
8
|
-
model: z.ZodDefault<z.ZodEnum<{
|
|
9
|
-
auto: "auto";
|
|
10
|
-
max: "max";
|
|
11
|
-
mini: "mini";
|
|
12
|
-
nano: "nano";
|
|
13
|
-
pro: "pro";
|
|
14
|
-
}>>;
|
|
15
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
16
|
-
callback: z.ZodOptional<z.ZodObject<{
|
|
17
|
-
url: z.ZodURL;
|
|
18
|
-
type: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strip>>;
|
|
20
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
-
data: z.ZodUnknown;
|
|
22
|
-
pageCount: z.ZodNumber;
|
|
23
|
-
model: z.ZodEnum<{
|
|
24
|
-
max: "max";
|
|
25
|
-
mini: "mini";
|
|
26
|
-
nano: "nano";
|
|
27
|
-
pro: "pro";
|
|
28
|
-
}>;
|
|
29
|
-
credits: z.ZodNumber;
|
|
30
|
-
requestId: z.ZodNumber;
|
|
31
|
-
documentId: z.ZodOptional<z.ZodString>;
|
|
32
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
33
|
-
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../lib/router/invoice/extract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8HxB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAYS,CAAC"}
|