@pdfvector/instance-contract 0.0.23 → 0.0.24

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.
@@ -13,12 +13,14 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
13
13
  }>>;
14
14
  }, z.core.$strip>, z.ZodObject<{
15
15
  markdown: z.ZodString;
16
+ pageCount: z.ZodNumber;
16
17
  model: z.ZodEnum<{
17
18
  nano: "nano";
18
19
  mini: "mini";
19
20
  pro: "pro";
20
21
  max: "max";
21
22
  }>;
23
+ credits: z.ZodNumber;
22
24
  requestId: z.ZodNumber;
23
25
  documentId: z.ZodOptional<z.ZodString>;
24
26
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -40,7 +40,12 @@ const askInputSchema = z.object({
40
40
  });
41
41
  const askOutputSchema = z.object({
42
42
  markdown: z.string().describe("The answer to the question"),
43
+ pageCount: z.number().int().describe("Total number of pages in the document"),
43
44
  model: pdfvectorModelSchema.describe("Model tier used to answer the question"),
45
+ credits: z
46
+ .number()
47
+ .int()
48
+ .describe("Number of credits consumed by this API call"),
44
49
  requestId: z
45
50
  .number()
46
51
  .int()
@@ -14,12 +14,14 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
14
14
  }>>;
15
15
  }, z.core.$strip>, z.ZodObject<{
16
16
  data: z.ZodUnknown;
17
+ pageCount: z.ZodNumber;
17
18
  model: z.ZodEnum<{
18
19
  nano: "nano";
19
20
  mini: "mini";
20
21
  pro: "pro";
21
22
  max: "max";
22
23
  }>;
24
+ credits: z.ZodNumber;
23
25
  requestId: z.ZodNumber;
24
26
  documentId: z.ZodOptional<z.ZodString>;
25
27
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -68,7 +68,12 @@ const extractOutputSchema = z.object({
68
68
  data: z
69
69
  .unknown()
70
70
  .describe("Extracted structured data matching the provided JSON Schema"),
71
+ pageCount: z.number().int().describe("Total number of pages in the document"),
71
72
  model: pdfvectorModelSchema.describe("Model tier used to extract the data"),
73
+ credits: z
74
+ .number()
75
+ .int()
76
+ .describe("Number of credits consumed by this API call"),
72
77
  requestId: z
73
78
  .number()
74
79
  .int()
@@ -15,6 +15,7 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
15
15
  pro: "pro";
16
16
  max: "max";
17
17
  }>;
18
+ credits: z.ZodNumber;
18
19
  requestId: z.ZodNumber;
19
20
  html: z.ZodOptional<z.ZodString>;
20
21
  documentId: z.ZodOptional<z.ZodString>;
@@ -41,6 +41,10 @@ const parseOutputSchema = z.object({
41
41
  model: z
42
42
  .enum(["pro", "max"])
43
43
  .describe("Model tier used to parse the bank statement"),
44
+ credits: z
45
+ .number()
46
+ .int()
47
+ .describe("Number of credits consumed by this API call"),
44
48
  requestId: z
45
49
  .number()
46
50
  .int()
@@ -13,12 +13,14 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
13
13
  }>>>;
14
14
  }, z.core.$strip>, z.ZodObject<{
15
15
  markdown: z.ZodString;
16
+ pageCount: z.ZodNumber;
16
17
  model: z.ZodEnum<{
17
18
  nano: "nano";
18
19
  mini: "mini";
19
20
  pro: "pro";
20
21
  max: "max";
21
22
  }>;
23
+ credits: z.ZodNumber;
22
24
  requestId: z.ZodNumber;
23
25
  documentId: z.ZodOptional<z.ZodString>;
24
26
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -42,11 +42,19 @@ const askInputSchema = z.object({
42
42
  const askOutputSchema = z
43
43
  .object({
44
44
  markdown: z.string().describe("The answer to the question"),
45
+ pageCount: z
46
+ .number()
47
+ .int()
48
+ .describe("Total number of pages in the document"),
45
49
  model: pdfvectorModelSchema.describe("Model tier used to answer the question. " +
46
50
  "'nano': Supports PDF, Word, Excel, CSV. " +
47
51
  "'mini': Supports PDF, Word, Excel, CSV. " +
48
52
  "'pro': Supports PDF, Word, Excel, CSV, Image. " +
49
53
  "'max': Supports PDF, Word, Excel, CSV, Image."),
54
+ credits: z
55
+ .number()
56
+ .int()
57
+ .describe("Number of credits consumed by this API call"),
50
58
  requestId: z
51
59
  .number()
52
60
  .int()
@@ -60,7 +68,9 @@ const askOutputSchema = z
60
68
  examples: [
61
69
  {
62
70
  markdown: "The study found that viral shedding peaked during the first week of symptoms, with the highest viral loads detected in throat swabs.",
71
+ pageCount: 12,
63
72
  model: "mini",
73
+ credits: 48,
64
74
  requestId: 1,
65
75
  },
66
76
  ],
@@ -14,12 +14,14 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
14
14
  }>>>;
15
15
  }, z.core.$strip>, z.ZodObject<{
16
16
  data: z.ZodUnknown;
17
+ pageCount: z.ZodNumber;
17
18
  model: z.ZodEnum<{
18
19
  nano: "nano";
19
20
  mini: "mini";
20
21
  pro: "pro";
21
22
  max: "max";
22
23
  }>;
24
+ credits: z.ZodNumber;
23
25
  requestId: z.ZodNumber;
24
26
  documentId: z.ZodOptional<z.ZodString>;
25
27
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -71,11 +71,19 @@ const extractOutputSchema = z
71
71
  data: z
72
72
  .unknown()
73
73
  .describe("Extracted structured data matching the provided JSON Schema"),
74
+ pageCount: z
75
+ .number()
76
+ .int()
77
+ .describe("Total number of pages in the document"),
74
78
  model: pdfvectorModelSchema.describe("Model tier used to extract the data. " +
75
79
  "'nano': Supports PDF, Word, Excel, CSV. " +
76
80
  "'mini': Supports PDF, Word, Excel, CSV. " +
77
81
  "'pro': Supports PDF, Word, Excel, CSV, Image. " +
78
82
  "'max': Supports PDF, Word, Excel, CSV, Image."),
83
+ credits: z
84
+ .number()
85
+ .int()
86
+ .describe("Number of credits consumed by this API call"),
79
87
  requestId: z
80
88
  .number()
81
89
  .int()
@@ -93,7 +101,9 @@ const extractOutputSchema = z
93
101
  authors: ["Roman Wölfel", "Victor M. Corman"],
94
102
  year: 2020,
95
103
  },
104
+ pageCount: 12,
96
105
  model: "mini",
106
+ credits: 48,
97
107
  requestId: 1,
98
108
  },
99
109
  ],
@@ -19,6 +19,7 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
19
19
  pro: "pro";
20
20
  max: "max";
21
21
  }>;
22
+ credits: z.ZodNumber;
22
23
  requestId: z.ZodNumber;
23
24
  html: z.ZodOptional<z.ZodString>;
24
25
  documentId: z.ZodOptional<z.ZodString>;
@@ -43,6 +43,10 @@ const parseOutputSchema = z.object({
43
43
  "'mini': Supports PDF, Word, Excel, CSV. " +
44
44
  "'pro': Supports PDF, Word, Excel, CSV, Image. " +
45
45
  "'max': Supports PDF, Word, Excel, CSV, Image."),
46
+ credits: z
47
+ .number()
48
+ .int()
49
+ .describe("Number of credits consumed by this API call"),
46
50
  requestId: z
47
51
  .number()
48
52
  .int()
@@ -13,12 +13,14 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
13
13
  }>>;
14
14
  }, z.core.$strip>, z.ZodObject<{
15
15
  markdown: z.ZodString;
16
+ pageCount: z.ZodNumber;
16
17
  model: z.ZodEnum<{
17
18
  nano: "nano";
18
19
  mini: "mini";
19
20
  pro: "pro";
20
21
  max: "max";
21
22
  }>;
23
+ credits: z.ZodNumber;
22
24
  requestId: z.ZodNumber;
23
25
  documentId: z.ZodOptional<z.ZodString>;
24
26
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -40,7 +40,12 @@ const askInputSchema = z.object({
40
40
  });
41
41
  const askOutputSchema = z.object({
42
42
  markdown: z.string().describe("The answer to the question"),
43
+ pageCount: z.number().int().describe("Total number of pages in the document"),
43
44
  model: pdfvectorModelSchema.describe("Model tier used to answer the question"),
45
+ credits: z
46
+ .number()
47
+ .int()
48
+ .describe("Number of credits consumed by this API call"),
44
49
  requestId: z
45
50
  .number()
46
51
  .int()
@@ -14,12 +14,14 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
14
14
  }>>;
15
15
  }, z.core.$strip>, z.ZodObject<{
16
16
  data: z.ZodUnknown;
17
+ pageCount: z.ZodNumber;
17
18
  model: z.ZodEnum<{
18
19
  nano: "nano";
19
20
  mini: "mini";
20
21
  pro: "pro";
21
22
  max: "max";
22
23
  }>;
24
+ credits: z.ZodNumber;
23
25
  requestId: z.ZodNumber;
24
26
  documentId: z.ZodOptional<z.ZodString>;
25
27
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -68,7 +68,12 @@ const extractOutputSchema = z.object({
68
68
  data: z
69
69
  .unknown()
70
70
  .describe("Extracted structured data matching the provided JSON Schema"),
71
+ pageCount: z.number().int().describe("Total number of pages in the document"),
71
72
  model: pdfvectorModelSchema.describe("Model tier used to extract the data"),
73
+ credits: z
74
+ .number()
75
+ .int()
76
+ .describe("Number of credits consumed by this API call"),
72
77
  requestId: z
73
78
  .number()
74
79
  .int()
@@ -17,6 +17,7 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
17
17
  }>;
18
18
  documentType: z.ZodOptional<z.ZodString>;
19
19
  html: z.ZodOptional<z.ZodString>;
20
+ credits: z.ZodNumber;
20
21
  requestId: z.ZodNumber;
21
22
  documentId: z.ZodOptional<z.ZodString>;
22
23
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -50,6 +50,10 @@ const parseOutputSchema = z.object({
50
50
  .optional()
51
51
  .describe("Full HTML representation of the document content. Only available when using the 'max' model. " +
52
52
  "Preserves rich formatting, tables, selection marks, and visual layout that cannot be fully represented in markdown."),
53
+ credits: z
54
+ .number()
55
+ .int()
56
+ .describe("Number of credits consumed by this API call"),
53
57
  requestId: z
54
58
  .number()
55
59
  .int()
@@ -13,12 +13,14 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
13
13
  }>>;
14
14
  }, z.core.$strip>, z.ZodObject<{
15
15
  markdown: z.ZodString;
16
+ pageCount: z.ZodNumber;
16
17
  model: z.ZodEnum<{
17
18
  nano: "nano";
18
19
  mini: "mini";
19
20
  pro: "pro";
20
21
  max: "max";
21
22
  }>;
23
+ credits: z.ZodNumber;
22
24
  requestId: z.ZodNumber;
23
25
  documentId: z.ZodOptional<z.ZodString>;
24
26
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -37,7 +37,12 @@ const askInputSchema = z.object({
37
37
  });
38
38
  const askOutputSchema = z.object({
39
39
  markdown: z.string().describe("The answer to the question"),
40
+ pageCount: z.number().int().describe("Total number of pages in the document"),
40
41
  model: pdfvectorModelSchema.describe("Model tier used to answer the question"),
42
+ credits: z
43
+ .number()
44
+ .int()
45
+ .describe("Number of credits consumed by this API call"),
41
46
  requestId: z
42
47
  .number()
43
48
  .int()
@@ -14,12 +14,14 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
14
14
  }>>;
15
15
  }, z.core.$strip>, z.ZodObject<{
16
16
  data: z.ZodUnknown;
17
+ pageCount: z.ZodNumber;
17
18
  model: z.ZodEnum<{
18
19
  nano: "nano";
19
20
  mini: "mini";
20
21
  pro: "pro";
21
22
  max: "max";
22
23
  }>;
24
+ credits: z.ZodNumber;
23
25
  requestId: z.ZodNumber;
24
26
  documentId: z.ZodOptional<z.ZodString>;
25
27
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -65,7 +65,12 @@ const extractOutputSchema = z.object({
65
65
  data: z
66
66
  .unknown()
67
67
  .describe("Extracted structured data matching the provided JSON Schema"),
68
+ pageCount: z.number().int().describe("Total number of pages in the document"),
68
69
  model: pdfvectorModelSchema.describe("Model tier used to extract the data"),
70
+ credits: z
71
+ .number()
72
+ .int()
73
+ .describe("Number of credits consumed by this API call"),
69
74
  requestId: z
70
75
  .number()
71
76
  .int()
@@ -15,6 +15,7 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
15
15
  pro: "pro";
16
16
  max: "max";
17
17
  }>;
18
+ credits: z.ZodNumber;
18
19
  requestId: z.ZodNumber;
19
20
  html: z.ZodOptional<z.ZodString>;
20
21
  documentId: z.ZodOptional<z.ZodString>;
@@ -36,6 +36,10 @@ const parseOutputSchema = z.object({
36
36
  model: z
37
37
  .enum(["pro", "max"])
38
38
  .describe("Model tier used to parse the invoice"),
39
+ credits: z
40
+ .number()
41
+ .int()
42
+ .describe("Number of credits consumed by this API call"),
39
43
  requestId: z
40
44
  .number()
41
45
  .int()
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @pdfvector/instance-contract
2
2
 
3
+ ## 0.0.24
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#133](https://github.com/phuctm97/pdfvector/pull/133) [`953cf32`](https://github.com/phuctm97/pdfvector/commit/953cf328a9eb30dd4dff3f40fd68dbfe4078901d) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add credits and pageCount to API responses, deduplicate ask/extract handlers, and improve extract prompt
9
+
3
10
  ## 0.0.23
4
11
  ### Patch Changes
5
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfvector/instance-contract",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "description": "API contract definitions for PDFVector instance server",
6
6
  "license": "MIT",