@pdfvector/instance-contract 0.0.31 → 0.0.33
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/pdfvector-model-schema.d.ts +1 -1
- package/.tsc/lib/router/academic/fetch.d.ts +1 -1
- package/.tsc/lib/router/academic/fetch.js +2 -1
- package/.tsc/lib/router/academic/find-citations.d.ts +1 -1
- package/.tsc/lib/router/academic/find-citations.js +2 -1
- package/.tsc/lib/router/academic/paper-graph.d.ts +1 -1
- package/.tsc/lib/router/academic/paper-graph.js +2 -1
- package/.tsc/lib/router/academic/search-grants.js +2 -1
- package/.tsc/lib/router/academic/search.d.ts +1 -1
- package/.tsc/lib/router/academic/search.js +2 -1
- package/.tsc/lib/router/academic/similar-papers.d.ts +1 -1
- package/.tsc/lib/router/academic/similar-papers.js +2 -1
- package/.tsc/lib/router/admin/get-free-usage-records.d.ts +21 -0
- package/.tsc/lib/router/admin/get-free-usage-records.js +34 -0
- package/.tsc/lib/router/admin/index.d.ts +1 -0
- package/.tsc/lib/router/admin/index.js +1 -0
- package/.tsc/lib/router/bankStatement/ask.d.ts +2 -2
- package/.tsc/lib/router/bankStatement/extract.d.ts +2 -2
- package/.tsc/lib/router/document/ask.d.ts +2 -2
- package/.tsc/lib/router/document/extract.d.ts +2 -2
- package/.tsc/lib/router/document/parse.d.ts +2 -2
- package/.tsc/lib/router/identity/ask.d.ts +2 -2
- package/.tsc/lib/router/identity/extract.d.ts +2 -2
- package/.tsc/lib/router/invoice/ask.d.ts +2 -2
- package/.tsc/lib/router/invoice/extract.d.ts +2 -2
- package/.tsc/lib/supported-mimes.js +45 -43
- package/CHANGELOG.md +17 -0
- package/package.json +4 -3
|
@@ -2,13 +2,13 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const fetch: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
3
|
ids: z.ZodArray<z.ZodString>;
|
|
4
4
|
fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
5
|
+
year: "year";
|
|
5
6
|
url: "url";
|
|
6
7
|
doi: "doi";
|
|
7
8
|
title: "title";
|
|
8
9
|
providerURL: "providerURL";
|
|
9
10
|
date: "date";
|
|
10
11
|
authors: "authors";
|
|
11
|
-
year: "year";
|
|
12
12
|
totalCitations: "totalCitations";
|
|
13
13
|
totalReferences: "totalReferences";
|
|
14
14
|
abstract: "abstract";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import { academicCreditCosts } from "@pdfvector/util";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const authorSchema = z.object({
|
|
4
5
|
name: z.string(),
|
|
@@ -101,7 +102,7 @@ export const fetch = oc
|
|
|
101
102
|
}))
|
|
102
103
|
.route({
|
|
103
104
|
summary: "Fetch academic papers by ID",
|
|
104
|
-
description:
|
|
105
|
+
description: `Fetch specific academic publications by their unique identifiers with automatic provider detection and batch processing. Costs ${academicCreditCosts.academicFetch} credits per request.`,
|
|
105
106
|
tags: ["Academic"],
|
|
106
107
|
spec: (op) => {
|
|
107
108
|
op.security = [{ bearerAuth: [] }];
|
|
@@ -12,13 +12,13 @@ export declare const findCitations: import("@orpc/contract").ContractProcedureBu
|
|
|
12
12
|
crossref: "crossref";
|
|
13
13
|
}>>>;
|
|
14
14
|
fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
15
|
+
year: "year";
|
|
15
16
|
url: "url";
|
|
16
17
|
doi: "doi";
|
|
17
18
|
title: "title";
|
|
18
19
|
providerURL: "providerURL";
|
|
19
20
|
date: "date";
|
|
20
21
|
authors: "authors";
|
|
21
|
-
year: "year";
|
|
22
22
|
totalCitations: "totalCitations";
|
|
23
23
|
totalReferences: "totalReferences";
|
|
24
24
|
abstract: "abstract";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import { academicCreditCosts } from "@pdfvector/util";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const providerSchema = z.enum([
|
|
4
5
|
"semantic-scholar",
|
|
@@ -109,7 +110,7 @@ export const findCitations = oc
|
|
|
109
110
|
}))
|
|
110
111
|
.route({
|
|
111
112
|
summary: "Find citations for a paragraph",
|
|
112
|
-
description:
|
|
113
|
+
description: `Find relevant academic citations for a paragraph by splitting it into sentences and scoring papers using semantic embedding similarity. Costs ${academicCreditCosts.academicFindCitationsPerSentence} credits per sentence.`,
|
|
113
114
|
tags: ["Academic"],
|
|
114
115
|
spec: (op) => {
|
|
115
116
|
op.security = [{ bearerAuth: [] }];
|
|
@@ -6,13 +6,13 @@ export declare const paperGraph: import("@orpc/contract").ContractProcedureBuild
|
|
|
6
6
|
citationsOffset: z.ZodDefault<z.ZodNumber>;
|
|
7
7
|
referencesOffset: z.ZodDefault<z.ZodNumber>;
|
|
8
8
|
fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
9
|
+
year: "year";
|
|
9
10
|
url: "url";
|
|
10
11
|
doi: "doi";
|
|
11
12
|
title: "title";
|
|
12
13
|
providerURL: "providerURL";
|
|
13
14
|
date: "date";
|
|
14
15
|
authors: "authors";
|
|
15
|
-
year: "year";
|
|
16
16
|
totalCitations: "totalCitations";
|
|
17
17
|
totalReferences: "totalReferences";
|
|
18
18
|
abstract: "abstract";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import { academicCreditCosts } from "@pdfvector/util";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const authorSchema = z.object({
|
|
4
5
|
name: z.string(),
|
|
@@ -125,7 +126,7 @@ export const paperGraph = oc
|
|
|
125
126
|
}))
|
|
126
127
|
.route({
|
|
127
128
|
summary: "Get paper citations and references",
|
|
128
|
-
description:
|
|
129
|
+
description: `Fetch a paper's citing papers and referenced papers as full publication objects with automatic provider detection and pagination support. Costs ${academicCreditCosts.academicPaperGraphMin}+ credits per request (scales with result count).`,
|
|
129
130
|
tags: ["Academic"],
|
|
130
131
|
spec: (op) => {
|
|
131
132
|
op.security = [{ bearerAuth: [] }];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import { academicCreditCosts } from "@pdfvector/util";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const grantProviderSchema = z.enum(["grants-gov", "nih-reporter", "cordis", "ukri"], {
|
|
4
5
|
message: "Invalid provider. Must be one of: grants-gov, nih-reporter, cordis, ukri",
|
|
@@ -155,7 +156,7 @@ export const searchGrants = oc
|
|
|
155
156
|
}))
|
|
156
157
|
.route({
|
|
157
158
|
summary: "Search grants",
|
|
158
|
-
description:
|
|
159
|
+
description: `Search for research grants and funding opportunities across multiple databases (Grants.gov, NIH RePORTER, CORDIS, UKRI) with unified results, relevance ranking, and filtering by deadline and funding amount. Costs ${academicCreditCosts.grantSearch} credits per request.`,
|
|
159
160
|
tags: ["Academic"],
|
|
160
161
|
spec: (op) => {
|
|
161
162
|
op.security = [{ bearerAuth: [] }];
|
|
@@ -16,13 +16,13 @@ export declare const search: import("@orpc/contract").ContractProcedureBuilderWi
|
|
|
16
16
|
yearFrom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
17
17
|
yearTo: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
18
18
|
fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
19
|
+
year: "year";
|
|
19
20
|
url: "url";
|
|
20
21
|
doi: "doi";
|
|
21
22
|
title: "title";
|
|
22
23
|
providerURL: "providerURL";
|
|
23
24
|
date: "date";
|
|
24
25
|
authors: "authors";
|
|
25
|
-
year: "year";
|
|
26
26
|
totalCitations: "totalCitations";
|
|
27
27
|
totalReferences: "totalReferences";
|
|
28
28
|
abstract: "abstract";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import { academicCreditCosts } from "@pdfvector/util";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const providerSchema = z.enum([
|
|
4
5
|
"semantic-scholar",
|
|
@@ -147,7 +148,7 @@ export const search = oc
|
|
|
147
148
|
}))
|
|
148
149
|
.route({
|
|
149
150
|
summary: "Search academic papers",
|
|
150
|
-
description:
|
|
151
|
+
description: `Search for academic publications across multiple databases with relevance ranking. Costs ${academicCreditCosts.academicSearch} credits per request.`,
|
|
151
152
|
tags: ["Academic"],
|
|
152
153
|
spec: (op) => {
|
|
153
154
|
op.security = [{ bearerAuth: [] }];
|
|
@@ -4,13 +4,13 @@ export declare const similarPapers: import("@orpc/contract").ContractProcedureBu
|
|
|
4
4
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
5
5
|
includeEdges: z.ZodDefault<z.ZodBoolean>;
|
|
6
6
|
fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
7
|
+
year: "year";
|
|
7
8
|
url: "url";
|
|
8
9
|
doi: "doi";
|
|
9
10
|
title: "title";
|
|
10
11
|
providerURL: "providerURL";
|
|
11
12
|
date: "date";
|
|
12
13
|
authors: "authors";
|
|
13
|
-
year: "year";
|
|
14
14
|
totalCitations: "totalCitations";
|
|
15
15
|
totalReferences: "totalReferences";
|
|
16
16
|
abstract: "abstract";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import { academicCreditCosts } from "@pdfvector/util";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const authorSchema = z.object({
|
|
4
5
|
name: z.string(),
|
|
@@ -124,7 +125,7 @@ export const similarPapers = oc
|
|
|
124
125
|
}))
|
|
125
126
|
.route({
|
|
126
127
|
summary: "Find similar papers",
|
|
127
|
-
description:
|
|
128
|
+
description: `Find papers similar to a seed paper using citation network analysis. Returns papers ranked by similarity with optional graph edge data for visualization. Costs ${academicCreditCosts.academicSimilarPapers} credits per request.`,
|
|
128
129
|
tags: ["Academic"],
|
|
129
130
|
spec: (op) => {
|
|
130
131
|
op.security = [{ bearerAuth: [] }];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getFreeUsageRecords: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
+
cursor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
4
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
records: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodNumber;
|
|
8
|
+
operation: z.ZodString;
|
|
9
|
+
ip: z.ZodString;
|
|
10
|
+
model: z.ZodNullable<z.ZodString>;
|
|
11
|
+
inputSource: z.ZodNullable<z.ZodString>;
|
|
12
|
+
inputRef: z.ZodNullable<z.ZodString>;
|
|
13
|
+
fileSize: z.ZodNullable<z.ZodNumber>;
|
|
14
|
+
documentType: z.ZodNullable<z.ZodString>;
|
|
15
|
+
pageCount: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
error: z.ZodNullable<z.ZodString>;
|
|
17
|
+
duration: z.ZodNumber;
|
|
18
|
+
createdAt: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
hasMore: z.ZodBoolean;
|
|
21
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const freeUsageRecordSchema = z.object({
|
|
4
|
+
id: z.number(),
|
|
5
|
+
operation: z.string(),
|
|
6
|
+
ip: z.string(),
|
|
7
|
+
model: z.string().nullable(),
|
|
8
|
+
inputSource: z.string().nullable(),
|
|
9
|
+
inputRef: z.string().nullable(),
|
|
10
|
+
fileSize: z.number().nullable(),
|
|
11
|
+
documentType: z.string().nullable(),
|
|
12
|
+
pageCount: z.number().nullable(),
|
|
13
|
+
error: z.string().nullable(),
|
|
14
|
+
duration: z.number(),
|
|
15
|
+
createdAt: z.number(),
|
|
16
|
+
});
|
|
17
|
+
export const getFreeUsageRecords = oc
|
|
18
|
+
.route({
|
|
19
|
+
summary: "Get free usage records",
|
|
20
|
+
description: "Returns free usage records with id > cursor, ordered by id ascending",
|
|
21
|
+
tags: ["Admin"],
|
|
22
|
+
spec: (op) => {
|
|
23
|
+
op.security = [{ bearerAuth: [] }];
|
|
24
|
+
return op;
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
.input(z.object({
|
|
28
|
+
cursor: z.number().optional().default(0),
|
|
29
|
+
limit: z.number().optional().default(1000),
|
|
30
|
+
}))
|
|
31
|
+
.output(z.object({
|
|
32
|
+
records: z.array(freeUsageRecordSchema),
|
|
33
|
+
hasMore: z.boolean(),
|
|
34
|
+
}));
|
|
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
5
5
|
base64: z.ZodOptional<z.ZodString>;
|
|
6
6
|
question: z.ZodString;
|
|
7
7
|
model: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
pro: "pro";
|
|
8
9
|
nano: "nano";
|
|
9
10
|
mini: "mini";
|
|
10
|
-
pro: "pro";
|
|
11
11
|
max: "max";
|
|
12
12
|
auto: "auto";
|
|
13
13
|
}>>;
|
|
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
19
19
|
markdown: z.ZodString;
|
|
20
20
|
pageCount: z.ZodNumber;
|
|
21
21
|
model: z.ZodEnum<{
|
|
22
|
+
pro: "pro";
|
|
22
23
|
nano: "nano";
|
|
23
24
|
mini: "mini";
|
|
24
|
-
pro: "pro";
|
|
25
25
|
max: "max";
|
|
26
26
|
}>;
|
|
27
27
|
credits: z.ZodNumber;
|
|
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
6
6
|
prompt: z.ZodString;
|
|
7
7
|
schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
|
|
8
8
|
model: z.ZodDefault<z.ZodEnum<{
|
|
9
|
+
pro: "pro";
|
|
9
10
|
nano: "nano";
|
|
10
11
|
mini: "mini";
|
|
11
|
-
pro: "pro";
|
|
12
12
|
max: "max";
|
|
13
13
|
auto: "auto";
|
|
14
14
|
}>>;
|
|
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
20
20
|
data: z.ZodUnknown;
|
|
21
21
|
pageCount: z.ZodNumber;
|
|
22
22
|
model: z.ZodEnum<{
|
|
23
|
+
pro: "pro";
|
|
23
24
|
nano: "nano";
|
|
24
25
|
mini: "mini";
|
|
25
|
-
pro: "pro";
|
|
26
26
|
max: "max";
|
|
27
27
|
}>;
|
|
28
28
|
credits: z.ZodNumber;
|
|
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
5
5
|
base64: z.ZodOptional<z.ZodString>;
|
|
6
6
|
question: z.ZodString;
|
|
7
7
|
model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
8
|
+
pro: "pro";
|
|
8
9
|
nano: "nano";
|
|
9
10
|
mini: "mini";
|
|
10
|
-
pro: "pro";
|
|
11
11
|
max: "max";
|
|
12
12
|
auto: "auto";
|
|
13
13
|
}>>>;
|
|
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
19
19
|
markdown: z.ZodString;
|
|
20
20
|
pageCount: z.ZodNumber;
|
|
21
21
|
model: z.ZodEnum<{
|
|
22
|
+
pro: "pro";
|
|
22
23
|
nano: "nano";
|
|
23
24
|
mini: "mini";
|
|
24
|
-
pro: "pro";
|
|
25
25
|
max: "max";
|
|
26
26
|
}>;
|
|
27
27
|
credits: z.ZodNumber;
|
|
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
6
6
|
prompt: z.ZodString;
|
|
7
7
|
schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
|
|
8
8
|
model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
pro: "pro";
|
|
9
10
|
nano: "nano";
|
|
10
11
|
mini: "mini";
|
|
11
|
-
pro: "pro";
|
|
12
12
|
max: "max";
|
|
13
13
|
auto: "auto";
|
|
14
14
|
}>>>;
|
|
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
20
20
|
data: z.ZodUnknown;
|
|
21
21
|
pageCount: z.ZodNumber;
|
|
22
22
|
model: z.ZodEnum<{
|
|
23
|
+
pro: "pro";
|
|
23
24
|
nano: "nano";
|
|
24
25
|
mini: "mini";
|
|
25
|
-
pro: "pro";
|
|
26
26
|
max: "max";
|
|
27
27
|
}>;
|
|
28
28
|
credits: z.ZodNumber;
|
|
@@ -4,9 +4,9 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
|
|
|
4
4
|
file: z.ZodOptional<z.ZodFile>;
|
|
5
5
|
base64: z.ZodOptional<z.ZodString>;
|
|
6
6
|
model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
pro: "pro";
|
|
7
8
|
nano: "nano";
|
|
8
9
|
mini: "mini";
|
|
9
|
-
pro: "pro";
|
|
10
10
|
max: "max";
|
|
11
11
|
auto: "auto";
|
|
12
12
|
}>>>;
|
|
@@ -18,9 +18,9 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
|
|
|
18
18
|
markdown: z.ZodString;
|
|
19
19
|
pageCount: z.ZodNumber;
|
|
20
20
|
model: z.ZodEnum<{
|
|
21
|
+
pro: "pro";
|
|
21
22
|
nano: "nano";
|
|
22
23
|
mini: "mini";
|
|
23
|
-
pro: "pro";
|
|
24
24
|
max: "max";
|
|
25
25
|
}>;
|
|
26
26
|
credits: z.ZodNumber;
|
|
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
5
5
|
base64: z.ZodOptional<z.ZodString>;
|
|
6
6
|
question: z.ZodString;
|
|
7
7
|
model: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
pro: "pro";
|
|
8
9
|
nano: "nano";
|
|
9
10
|
mini: "mini";
|
|
10
|
-
pro: "pro";
|
|
11
11
|
max: "max";
|
|
12
12
|
auto: "auto";
|
|
13
13
|
}>>;
|
|
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
19
19
|
markdown: z.ZodString;
|
|
20
20
|
pageCount: z.ZodNumber;
|
|
21
21
|
model: z.ZodEnum<{
|
|
22
|
+
pro: "pro";
|
|
22
23
|
nano: "nano";
|
|
23
24
|
mini: "mini";
|
|
24
|
-
pro: "pro";
|
|
25
25
|
max: "max";
|
|
26
26
|
}>;
|
|
27
27
|
credits: z.ZodNumber;
|
|
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
6
6
|
prompt: z.ZodString;
|
|
7
7
|
schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
|
|
8
8
|
model: z.ZodDefault<z.ZodEnum<{
|
|
9
|
+
pro: "pro";
|
|
9
10
|
nano: "nano";
|
|
10
11
|
mini: "mini";
|
|
11
|
-
pro: "pro";
|
|
12
12
|
max: "max";
|
|
13
13
|
auto: "auto";
|
|
14
14
|
}>>;
|
|
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
20
20
|
data: z.ZodUnknown;
|
|
21
21
|
pageCount: z.ZodNumber;
|
|
22
22
|
model: z.ZodEnum<{
|
|
23
|
+
pro: "pro";
|
|
23
24
|
nano: "nano";
|
|
24
25
|
mini: "mini";
|
|
25
|
-
pro: "pro";
|
|
26
26
|
max: "max";
|
|
27
27
|
}>;
|
|
28
28
|
credits: z.ZodNumber;
|
|
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
5
5
|
base64: z.ZodOptional<z.ZodString>;
|
|
6
6
|
question: z.ZodString;
|
|
7
7
|
model: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
pro: "pro";
|
|
8
9
|
nano: "nano";
|
|
9
10
|
mini: "mini";
|
|
10
|
-
pro: "pro";
|
|
11
11
|
max: "max";
|
|
12
12
|
auto: "auto";
|
|
13
13
|
}>>;
|
|
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
|
|
|
19
19
|
markdown: z.ZodString;
|
|
20
20
|
pageCount: z.ZodNumber;
|
|
21
21
|
model: z.ZodEnum<{
|
|
22
|
+
pro: "pro";
|
|
22
23
|
nano: "nano";
|
|
23
24
|
mini: "mini";
|
|
24
|
-
pro: "pro";
|
|
25
25
|
max: "max";
|
|
26
26
|
}>;
|
|
27
27
|
credits: z.ZodNumber;
|
|
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
6
6
|
prompt: z.ZodString;
|
|
7
7
|
schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
|
|
8
8
|
model: z.ZodDefault<z.ZodEnum<{
|
|
9
|
+
pro: "pro";
|
|
9
10
|
nano: "nano";
|
|
10
11
|
mini: "mini";
|
|
11
|
-
pro: "pro";
|
|
12
12
|
max: "max";
|
|
13
13
|
auto: "auto";
|
|
14
14
|
}>>;
|
|
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
20
20
|
data: z.ZodUnknown;
|
|
21
21
|
pageCount: z.ZodNumber;
|
|
22
22
|
model: z.ZodEnum<{
|
|
23
|
+
pro: "pro";
|
|
23
24
|
nano: "nano";
|
|
24
25
|
mini: "mini";
|
|
25
|
-
pro: "pro";
|
|
26
26
|
max: "max";
|
|
27
27
|
}>;
|
|
28
28
|
credits: z.ZodNumber;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { allSupportedFormatsLong, allSupportedFormatsShort, documentAskExtractCosts, documentParseCosts, formatsByTierDescription, specializedAskExtractCosts, specializedParseCosts, tierLimits, } from "@pdfvector/util";
|
|
1
2
|
/**
|
|
2
3
|
* All MIME types accepted for file uploads across all API endpoints.
|
|
3
4
|
* Single source of truth — imported by all contract schemas.
|
|
@@ -38,69 +39,70 @@ export const supportedFileMimes = [
|
|
|
38
39
|
// Bibliography / Academic
|
|
39
40
|
"application/x-bibtex",
|
|
40
41
|
];
|
|
41
|
-
export const supportedFileFormatsDescription =
|
|
42
|
+
export const supportedFileFormatsDescription = allSupportedFormatsShort;
|
|
42
43
|
/**
|
|
43
44
|
* Human-readable description of supported file types with extensions.
|
|
44
45
|
* Used in route-level API descriptions.
|
|
45
46
|
*/
|
|
46
|
-
export const supportedFileTypesLong =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
export const supportedFileTypesLong = allSupportedFormatsLong;
|
|
48
|
+
const formatNote = `\n\n${formatsByTierDescription}`;
|
|
49
|
+
function fmtSize(bytes) {
|
|
50
|
+
return `${bytes / (1024 * 1024)}MB`;
|
|
51
|
+
}
|
|
52
|
+
function tierDesc(tier, credits, unit, extra) {
|
|
53
|
+
const limit = tierLimits[tier];
|
|
54
|
+
const limitStr = limit
|
|
55
|
+
? `Up to ${limit.maxPages} pages, ${fmtSize(limit.maxFileSize)}.`
|
|
56
|
+
: "";
|
|
57
|
+
return `- ${tier}: ${credits} ${unit}. ${extra}${limitStr ? ` ${limitStr}` : ""}`;
|
|
58
|
+
}
|
|
59
|
+
// biome-ignore lint/style/noNonNullAssertion: auto tier always exists
|
|
60
|
+
const autoLimit = tierLimits.auto;
|
|
61
|
+
const autoLimitStr = `Up to ${autoLimit.maxPages} pages, ${fmtSize(autoLimit.maxFileSize)}.`;
|
|
60
62
|
/** Model tier descriptions for document parse endpoints. */
|
|
61
63
|
export const documentParseModelDescription = "Model tier for parsing.\n\n" +
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
64
|
+
`- auto (default): Intelligent fallback — credits based on the tier selected automatically. ${autoLimitStr}\n` +
|
|
65
|
+
`${tierDesc("nano", documentParseCosts.nano, "credit/page", "Simple plain text documents.")}\n` +
|
|
66
|
+
`${tierDesc("mini", documentParseCosts.mini, "credits/page", "Documents with tables and structured content.")}\n` +
|
|
67
|
+
`${tierDesc("pro", documentParseCosts.pro, "credits/page", "Tables, handwritten text, figures, math, Arabic.")}\n` +
|
|
68
|
+
`${tierDesc("max", documentParseCosts.max, "credits/page", "Full Pro capabilities + enhanced multilingual.")}` +
|
|
67
69
|
formatNote;
|
|
68
70
|
/** Model tier descriptions for document extract endpoints. */
|
|
69
71
|
export const documentExtractModelDescription = "Model tier for extracting structured data.\n\n" +
|
|
70
|
-
"- auto (default): Automatically selects the best tier based on
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
"- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
|
|
73
|
+
`- nano: ${documentAskExtractCosts.nano} credits/page. Fastest. Best for simple documents with straightforward schemas.\n` +
|
|
74
|
+
`- mini: ${documentAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex schemas.\n` +
|
|
75
|
+
`- pro: ${documentAskExtractCosts.pro} credits/page. High accuracy for complex documents with large or nested schemas.\n` +
|
|
76
|
+
`- max: ${documentAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult extractions requiring deep reasoning.` +
|
|
75
77
|
formatNote;
|
|
76
78
|
/** Model tier descriptions for document ask endpoints. */
|
|
77
79
|
export const documentAskModelDescription = "Model tier for answering the question.\n\n" +
|
|
78
|
-
"- auto (default): Automatically selects the best tier based on
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
"- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
|
|
81
|
+
`- nano: ${documentAskExtractCosts.nano} credits/page. Fastest. Best for simple questions about straightforward documents.\n` +
|
|
82
|
+
`- mini: ${documentAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex questions.\n` +
|
|
83
|
+
`- pro: ${documentAskExtractCosts.pro} credits/page. High accuracy for nuanced questions about complex documents.\n` +
|
|
84
|
+
`- max: ${documentAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult questions requiring deep reasoning.` +
|
|
83
85
|
formatNote;
|
|
84
86
|
/** Model tier descriptions for invoice/identity/bankStatement parse endpoints (pro/max/auto only). */
|
|
85
87
|
export const specializedParseModelDescription = (type) => "Model tier for parsing.\n\n" +
|
|
86
|
-
"- auto (default): Intelligent fallback.\n" +
|
|
87
|
-
`- pro:
|
|
88
|
-
`- max:
|
|
88
|
+
"- auto (default): Intelligent fallback — credits based on the tier selected.\n" +
|
|
89
|
+
`- pro: ${specializedParseCosts.pro} credits/page. Extracts structured ${type} fields with standard accuracy.\n` +
|
|
90
|
+
`- max: ${specializedParseCosts.max} credits/page. Extracts structured ${type} fields with highest accuracy and fallback.`;
|
|
89
91
|
/** Model tier descriptions for invoice/identity/bankStatement extract endpoints. */
|
|
90
92
|
export const specializedExtractModelDescription = "Model tier for extracting structured data.\n\n" +
|
|
91
|
-
"- auto (default): Automatically selects the best tier based on
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
"- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
|
|
94
|
+
`- nano: ${specializedAskExtractCosts.nano} credits/page. Fastest. Best for simple documents with straightforward schemas.\n` +
|
|
95
|
+
`- mini: ${specializedAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex schemas.\n` +
|
|
96
|
+
`- pro: ${specializedAskExtractCosts.pro} credits/page. High accuracy for complex documents with large or nested schemas.\n` +
|
|
97
|
+
`- max: ${specializedAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult extractions requiring deep reasoning.` +
|
|
96
98
|
formatNote;
|
|
97
99
|
/** Model tier descriptions for invoice/identity/bankStatement ask endpoints. */
|
|
98
100
|
export const specializedAskModelDescription = "Model tier for answering the question.\n\n" +
|
|
99
|
-
"- auto (default): Automatically selects the best tier based on
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
"- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
|
|
102
|
+
`- nano: ${specializedAskExtractCosts.nano} credits/page. Fastest. Best for simple questions about straightforward documents.\n` +
|
|
103
|
+
`- mini: ${specializedAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex questions.\n` +
|
|
104
|
+
`- pro: ${specializedAskExtractCosts.pro} credits/page. High accuracy for nuanced questions about complex documents.\n` +
|
|
105
|
+
`- max: ${specializedAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult questions requiring deep reasoning.` +
|
|
104
106
|
formatNote;
|
|
105
107
|
/** Output model description for parse results. */
|
|
106
108
|
export const outputModelDescription = "Model tier used to parse the document.\n\n" +
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @pdfvector/instance-contract
|
|
2
2
|
|
|
3
|
+
## 0.0.33
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#176](https://github.com/phuctm97/pdfvector/pull/176) [`cfbc548`](https://github.com/phuctm97/pdfvector/commit/cfbc54864ef055bb68ea081b3ead7ba69ca2c819) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add free usage sync, centralize tier limits/credits, deduplicate parse handlers
|
|
9
|
+
|
|
10
|
+
- Updated dependencies [[`cfbc548`](https://github.com/phuctm97/pdfvector/commit/cfbc54864ef055bb68ea081b3ead7ba69ca2c819)]:
|
|
11
|
+
- @pdfvector/util@0.0.17
|
|
12
|
+
|
|
13
|
+
## 0.0.32
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
- [#159](https://github.com/phuctm97/pdfvector/pull/159) [`931317b`](https://github.com/phuctm97/pdfvector/commit/931317bd4732e56147d11f48cf6a203aa9983db2) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add admin user detail sheet and plan/credits columns
|
|
19
|
+
|
|
3
20
|
## 0.0.31
|
|
4
21
|
### Patch Changes
|
|
5
22
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfvector/instance-contract",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "API contract definitions for
|
|
5
|
+
"description": "API contract definitions for PDF Vector instance server",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"main": ".tsc/lib/index.js",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@orpc/contract": "^1.13.13"
|
|
23
|
+
"@orpc/contract": "^1.13.13",
|
|
24
|
+
"@pdfvector/util": "0.0.16"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"zod": "^4.3.6"
|