@pdfvector/instance-contract 0.0.8 → 0.0.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/router/authenticate/index.d.ts +1 -0
- package/.tsc/lib/router/authenticate/index.js +1 -0
- package/.tsc/lib/router/authenticate/validate-credential.d.ts +6 -0
- package/.tsc/lib/router/authenticate/validate-credential.js +20 -0
- package/.tsc/lib/router/document/ask.js +7 -7
- package/.tsc/lib/router/document/extract.d.ts +2 -2
- package/.tsc/lib/router/document/extract.js +35 -7
- package/.tsc/lib/router/document/parse.js +4 -4
- package/.tsc/lib/router/index.d.ts +1 -0
- package/.tsc/lib/router/index.js +1 -0
- package/CHANGELOG.md +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./validate-credential";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./validate-credential";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const validateCredential: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
3
|
+
status: z.ZodString;
|
|
4
|
+
version: z.ZodString;
|
|
5
|
+
timestamp: z.ZodString;
|
|
6
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const inputSchema = z.object({}).optional();
|
|
4
|
+
const outputSchema = z.object({
|
|
5
|
+
status: z.string().describe("Server status indicator"),
|
|
6
|
+
version: z.string().describe("Server version"),
|
|
7
|
+
timestamp: z.string().describe("Current server timestamp in ISO 8601 format"),
|
|
8
|
+
});
|
|
9
|
+
export const validateCredential = oc
|
|
10
|
+
.route({
|
|
11
|
+
summary: "Validate API credential",
|
|
12
|
+
description: "Verify that the API key is valid and the server is reachable. Returns basic server information.",
|
|
13
|
+
tags: ["Authenticate"],
|
|
14
|
+
spec: (op) => {
|
|
15
|
+
op.security = [{ bearerAuth: [] }];
|
|
16
|
+
return op;
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
.input(inputSchema)
|
|
20
|
+
.output(outputSchema);
|
|
@@ -34,10 +34,10 @@ const askInputSchema = z.object({
|
|
|
34
34
|
.default("auto")
|
|
35
35
|
.describe("Model tier for answering the question. " +
|
|
36
36
|
"'auto' (default): Automatically selects the best tier based on document page count and document complexity. " +
|
|
37
|
-
"'nano': Uses lightweight models (
|
|
38
|
-
"'mini': Uses mid-range models (
|
|
39
|
-
"'pro': Uses capable models (
|
|
40
|
-
"'max': Uses the most powerful models (
|
|
37
|
+
"'nano': Uses lightweight models (likely better than GPT-5-nano). Supports PDF, Word, Excel, CSV. " +
|
|
38
|
+
"'mini': Uses mid-range models (likely better than GPT-5-mini). Supports PDF, Word, Excel, CSV. " +
|
|
39
|
+
"'pro': Uses capable models (likely better than GPT-5.2). Supports PDF, Word, Excel, CSV, Image. " +
|
|
40
|
+
"'max': Uses the most powerful models (likely better than Claude Opus 4.6). Supports PDF, Word, Excel, CSV, Image."),
|
|
41
41
|
});
|
|
42
42
|
const askOutputSchema = z
|
|
43
43
|
.object({
|
|
@@ -60,7 +60,7 @@ const requestExamples = {
|
|
|
60
60
|
"Ask from URL": {
|
|
61
61
|
summary: "Ask from URL",
|
|
62
62
|
value: {
|
|
63
|
-
url: "https://
|
|
63
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
64
64
|
question: "What are the main findings of this study?",
|
|
65
65
|
},
|
|
66
66
|
},
|
|
@@ -81,7 +81,7 @@ const requestExamples = {
|
|
|
81
81
|
"Ask with lightweight models (nano)": {
|
|
82
82
|
summary: "Ask with lightweight models (nano)",
|
|
83
83
|
value: {
|
|
84
|
-
url: "https://
|
|
84
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
85
85
|
question: "What is the title of this paper?",
|
|
86
86
|
model: "nano",
|
|
87
87
|
},
|
|
@@ -89,7 +89,7 @@ const requestExamples = {
|
|
|
89
89
|
"Ask with powerful models (max)": {
|
|
90
90
|
summary: "Ask with powerful models (max)",
|
|
91
91
|
value: {
|
|
92
|
-
url: "https://
|
|
92
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
93
93
|
question: "Provide a detailed analysis of the methodology used in this study.",
|
|
94
94
|
model: "max",
|
|
95
95
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const extract: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
2
|
+
export declare const extract: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
3
3
|
url: z.ZodOptional<z.ZodURL>;
|
|
4
4
|
file: z.ZodOptional<z.ZodFile>;
|
|
5
5
|
base64: z.ZodOptional<z.ZodString>;
|
|
@@ -12,7 +12,7 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
|
|
|
12
12
|
max: "max";
|
|
13
13
|
auto: "auto";
|
|
14
14
|
}>>>;
|
|
15
|
-
}, z.core.$strip
|
|
15
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
16
16
|
data: z.ZodUnknown;
|
|
17
17
|
model: z.ZodEnum<{
|
|
18
18
|
nano: "nano";
|
|
@@ -2,7 +2,35 @@ import { oc } from "@orpc/contract";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { pdfvectorModelSchema } from "../../pdfvector-model-schema";
|
|
4
4
|
import { getDefaultSpec } from "./get-default-spec";
|
|
5
|
-
|
|
5
|
+
// Support for dot-notation in multipart form-data
|
|
6
|
+
function expandDotNotation(input) {
|
|
7
|
+
if (typeof input !== "object" || input === null)
|
|
8
|
+
return input;
|
|
9
|
+
const obj = input;
|
|
10
|
+
const dotKeys = Object.keys(obj).filter((k) => k.includes("."));
|
|
11
|
+
if (dotKeys.length === 0)
|
|
12
|
+
return input;
|
|
13
|
+
const result = { ...obj };
|
|
14
|
+
for (const key of dotKeys) {
|
|
15
|
+
const parts = key.split(".");
|
|
16
|
+
let current = result;
|
|
17
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
18
|
+
const part = parts[i];
|
|
19
|
+
if (part === undefined)
|
|
20
|
+
continue;
|
|
21
|
+
if (!(part in current) || typeof current[part] !== "object") {
|
|
22
|
+
current[part] = {};
|
|
23
|
+
}
|
|
24
|
+
current = current[part];
|
|
25
|
+
}
|
|
26
|
+
const lastPart = parts[parts.length - 1];
|
|
27
|
+
if (lastPart !== undefined)
|
|
28
|
+
current[lastPart] = obj[key];
|
|
29
|
+
delete result[key];
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
const extractInputSchema = z.preprocess(expandDotNotation, z.object({
|
|
6
34
|
url: z
|
|
7
35
|
.url()
|
|
8
36
|
.optional()
|
|
@@ -37,11 +65,11 @@ const extractInputSchema = z.object({
|
|
|
37
65
|
.default("auto")
|
|
38
66
|
.describe("Model tier for extracting structured data. " +
|
|
39
67
|
"'auto' (default): Automatically selects the best tier based on document page count and document complexity. " +
|
|
40
|
-
"'nano': Uses lightweight models (
|
|
41
|
-
"'mini': Uses mid-range models (
|
|
42
|
-
"'pro': Uses capable models (
|
|
43
|
-
"'max': Uses the most powerful models (
|
|
44
|
-
});
|
|
68
|
+
"'nano': Uses lightweight models (likely better than GPT-5-nano). Supports PDF, Word, Excel, CSV. " +
|
|
69
|
+
"'mini': Uses mid-range models (likely better than GPT-5-mini). Supports PDF, Word, Excel, CSV. " +
|
|
70
|
+
"'pro': Uses capable models (likely better than GPT-5.2). Supports PDF, Word, Excel, CSV, Image. " +
|
|
71
|
+
"'max': Uses the most powerful models (likely better than Claude Opus 4.6). Supports PDF, Word, Excel, CSV, Image."),
|
|
72
|
+
}));
|
|
45
73
|
const extractOutputSchema = z
|
|
46
74
|
.object({
|
|
47
75
|
data: z
|
|
@@ -69,7 +97,7 @@ const requestExamples = {
|
|
|
69
97
|
"Extract from URL": {
|
|
70
98
|
summary: "Extract from URL",
|
|
71
99
|
value: {
|
|
72
|
-
url: "https://
|
|
100
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
73
101
|
prompt: "Extract the title, authors, and publication year from this research paper",
|
|
74
102
|
schema: {
|
|
75
103
|
type: "object",
|
|
@@ -61,7 +61,7 @@ const requestExamples = {
|
|
|
61
61
|
"Parse from URL": {
|
|
62
62
|
summary: "Parse from URL",
|
|
63
63
|
value: {
|
|
64
|
-
url: "https://
|
|
64
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
"Parse from base64": {
|
|
@@ -79,21 +79,21 @@ const requestExamples = {
|
|
|
79
79
|
"Parse with simple PDF (nano)": {
|
|
80
80
|
summary: "Parse with simple PDF (nano)",
|
|
81
81
|
value: {
|
|
82
|
-
url: "https://
|
|
82
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
83
83
|
model: "nano",
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
86
|
"Parse with small complex documents (pro)": {
|
|
87
87
|
summary: "Parse with small complex documents (pro)",
|
|
88
88
|
value: {
|
|
89
|
-
url: "https://
|
|
89
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
90
90
|
model: "pro",
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
93
|
"Parse with large complex documents (max)": {
|
|
94
94
|
summary: "Parse with large complex documents (max)",
|
|
95
95
|
value: {
|
|
96
|
-
url: "https://
|
|
96
|
+
url: "https://drive.google.com/file/d/1nRBJK5Eh7pUy6DIHncwAp-pFq_Su8TTq/view?usp=share_link",
|
|
97
97
|
model: "max",
|
|
98
98
|
},
|
|
99
99
|
},
|
package/.tsc/lib/router/index.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @pdfvector/instance-contract
|
|
2
2
|
|
|
3
|
+
## 0.0.9
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#63](https://github.com/phuctm97/pdfvector/pull/63) [`771f17f`](https://github.com/phuctm97/pdfvector/commit/771f17fc949800d4a44d4caed73322c6552cdbef) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Update example
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
- [#60](https://github.com/phuctm97/pdfvector/pull/60) [`163b517`](https://github.com/phuctm97/pdfvector/commit/163b517715a63172a1fd3814128f2f78503a926b) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Using nova model
|
|
13
|
+
|
|
3
14
|
## 0.0.8
|
|
4
15
|
### Patch Changes
|
|
5
16
|
|