@pdfvector/client 0.2.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pdfvector/client
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#725](https://github.com/orchestero/pdfvector/pull/725) [`4e9bd5f`](https://github.com/orchestero/pdfvector/commit/4e9bd5f264452ee6f733ebf1966e86b1ea94b254) Thanks [@orchestero](https://github.com/orchestero)! - Package metadata: repository moved to orchestero/pdfvector
8
+ - Updated dependencies [[`4e9bd5f`](https://github.com/orchestero/pdfvector/commit/4e9bd5f264452ee6f733ebf1966e86b1ea94b254)]:
9
+ - @pdfvector/instance-client@0.2.1
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  ### Minor Changes
package/dist/contract.cjs CHANGED
@@ -2481,7 +2481,7 @@ const search = oc.input(zod.z.object({
2481
2481
  })).output(zod.z.object({
2482
2482
  estimatedTotalResults: zod.z.number(),
2483
2483
  results: zod.z.array(publicationSchema$1),
2484
- errors: zod.z.array(providerErrorSchema$1).nullish().describe("Providers that failed for this request (for example rate limited or unavailable). When present, `results` only contain papers from the providers that succeeded, so treat the response as partial; it is billed like any successful search. If every provider fails, the request fails with HTTP 503 (`SERVICE_UNAVAILABLE`, `data.code` `ALL_PROVIDERS_FAILED`, per-provider `data.errors`) and is not charged."),
2484
+ errors: zod.z.array(providerErrorSchema$1).nullish().describe("Providers that failed for this request (for example rate limited or unavailable). When present, `results` only contain papers from the providers that succeeded, so treat the response as partial; it is billed like any successful search. If every requested provider fails and they include `europe-pmc` but not `pubmed`, the search falls back to `pubmed` with the time left: `results` then come from PubMed (each result's `provider` says so) and each failed provider's entry here has `details.fallbackProvider` `pubmed`; it is billed like any successful search. If every provider fails (including that fallback, whose entry then has `details.fallback` `true`), the request fails with HTTP 503 (`SERVICE_UNAVAILABLE`, `data.code` `ALL_PROVIDERS_FAILED`, per-provider `data.errors`) and is not charged."),
2485
2485
  requestId: zod.z.number().int()
2486
2486
  })).route({
2487
2487
  summary: "Search academic papers",
@@ -4113,34 +4113,59 @@ const extractOutputSchema = zod.z.object({
4113
4113
  requestId: zod.z.number().int().describe("Unique request identifier for this API call"),
4114
4114
  documentId: zod.z.string().optional().describe("Document ID if provided via x-pdfvector-document-id header or request body")
4115
4115
  });
4116
- const requestExamples$1 = { "Extract from URL": {
4117
- summary: "Extract from URL",
4118
- value: {
4119
- url: "https://example.com/invoice.pdf",
4120
- prompt: "Extract the vendor name, total amount, and line items",
4121
- schema: JSON.stringify({
4122
- type: "object",
4123
- properties: {
4124
- vendorName: { type: "string" },
4125
- totalAmount: { type: "number" },
4126
- lineItems: {
4116
+ const requestExamples$1 = {
4117
+ "Extract from URL": {
4118
+ summary: "Extract from URL",
4119
+ value: {
4120
+ url: "https://example.com/invoice.pdf",
4121
+ prompt: "Extract the vendor name, total amount, and line items",
4122
+ schema: JSON.stringify({
4123
+ type: "object",
4124
+ properties: {
4125
+ vendorName: { type: "string" },
4126
+ totalAmount: { type: "number" },
4127
+ lineItems: {
4128
+ type: "array",
4129
+ items: {
4130
+ type: "object",
4131
+ properties: {
4132
+ description: { type: "string" },
4133
+ amount: { type: "number" }
4134
+ }
4135
+ }
4136
+ }
4137
+ },
4138
+ required: ["vendorName", "totalAmount"]
4139
+ })
4140
+ }
4141
+ },
4142
+ "Many invoices in one PDF": {
4143
+ summary: "Many invoices in one PDF",
4144
+ value: {
4145
+ url: "https://example.com/batched-invoices.pdf",
4146
+ prompt: "Extract every invoice in the file as a separate item, one per invoice number",
4147
+ schema: JSON.stringify({
4148
+ type: "object",
4149
+ properties: { invoices: {
4127
4150
  type: "array",
4128
4151
  items: {
4129
4152
  type: "object",
4130
4153
  properties: {
4131
- description: { type: "string" },
4132
- amount: { type: "number" }
4133
- }
4154
+ invoiceNumber: { type: "string" },
4155
+ vendorName: { type: "string" },
4156
+ totalAmount: { type: "number" }
4157
+ },
4158
+ required: ["invoiceNumber", "totalAmount"]
4134
4159
  }
4135
- }
4136
- },
4137
- required: ["vendorName", "totalAmount"]
4138
- })
4160
+ } },
4161
+ required: ["invoices"]
4162
+ })
4163
+ }
4139
4164
  }
4140
- } };
4165
+ };
4141
4166
  const extract = oc.route({
4142
4167
  summary: "Extract structured data from an invoice",
4143
- description: `Parse an invoice 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.`,
4168
+ description: `Parse an invoice 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. For a file that holds several invoices, make the schema an object with an array property of invoice objects (see the "Many invoices in one PDF" example) to get one item per invoice.`,
4144
4169
  tags: ["Invoice"],
4145
4170
  spec: (op) => {
4146
4171
  const spec = getDefaultSpec(op, requestExamples$1);
package/dist/contract.mjs CHANGED
@@ -2470,7 +2470,7 @@ const search = oc.input(z.object({
2470
2470
  })).output(z.object({
2471
2471
  estimatedTotalResults: z.number(),
2472
2472
  results: z.array(publicationSchema$1),
2473
- errors: z.array(providerErrorSchema$1).nullish().describe("Providers that failed for this request (for example rate limited or unavailable). When present, `results` only contain papers from the providers that succeeded, so treat the response as partial; it is billed like any successful search. If every provider fails, the request fails with HTTP 503 (`SERVICE_UNAVAILABLE`, `data.code` `ALL_PROVIDERS_FAILED`, per-provider `data.errors`) and is not charged."),
2473
+ errors: z.array(providerErrorSchema$1).nullish().describe("Providers that failed for this request (for example rate limited or unavailable). When present, `results` only contain papers from the providers that succeeded, so treat the response as partial; it is billed like any successful search. If every requested provider fails and they include `europe-pmc` but not `pubmed`, the search falls back to `pubmed` with the time left: `results` then come from PubMed (each result's `provider` says so) and each failed provider's entry here has `details.fallbackProvider` `pubmed`; it is billed like any successful search. If every provider fails (including that fallback, whose entry then has `details.fallback` `true`), the request fails with HTTP 503 (`SERVICE_UNAVAILABLE`, `data.code` `ALL_PROVIDERS_FAILED`, per-provider `data.errors`) and is not charged."),
2474
2474
  requestId: z.number().int()
2475
2475
  })).route({
2476
2476
  summary: "Search academic papers",
@@ -4102,34 +4102,59 @@ const extractOutputSchema = z.object({
4102
4102
  requestId: z.number().int().describe("Unique request identifier for this API call"),
4103
4103
  documentId: z.string().optional().describe("Document ID if provided via x-pdfvector-document-id header or request body")
4104
4104
  });
4105
- const requestExamples$1 = { "Extract from URL": {
4106
- summary: "Extract from URL",
4107
- value: {
4108
- url: "https://example.com/invoice.pdf",
4109
- prompt: "Extract the vendor name, total amount, and line items",
4110
- schema: JSON.stringify({
4111
- type: "object",
4112
- properties: {
4113
- vendorName: { type: "string" },
4114
- totalAmount: { type: "number" },
4115
- lineItems: {
4105
+ const requestExamples$1 = {
4106
+ "Extract from URL": {
4107
+ summary: "Extract from URL",
4108
+ value: {
4109
+ url: "https://example.com/invoice.pdf",
4110
+ prompt: "Extract the vendor name, total amount, and line items",
4111
+ schema: JSON.stringify({
4112
+ type: "object",
4113
+ properties: {
4114
+ vendorName: { type: "string" },
4115
+ totalAmount: { type: "number" },
4116
+ lineItems: {
4117
+ type: "array",
4118
+ items: {
4119
+ type: "object",
4120
+ properties: {
4121
+ description: { type: "string" },
4122
+ amount: { type: "number" }
4123
+ }
4124
+ }
4125
+ }
4126
+ },
4127
+ required: ["vendorName", "totalAmount"]
4128
+ })
4129
+ }
4130
+ },
4131
+ "Many invoices in one PDF": {
4132
+ summary: "Many invoices in one PDF",
4133
+ value: {
4134
+ url: "https://example.com/batched-invoices.pdf",
4135
+ prompt: "Extract every invoice in the file as a separate item, one per invoice number",
4136
+ schema: JSON.stringify({
4137
+ type: "object",
4138
+ properties: { invoices: {
4116
4139
  type: "array",
4117
4140
  items: {
4118
4141
  type: "object",
4119
4142
  properties: {
4120
- description: { type: "string" },
4121
- amount: { type: "number" }
4122
- }
4143
+ invoiceNumber: { type: "string" },
4144
+ vendorName: { type: "string" },
4145
+ totalAmount: { type: "number" }
4146
+ },
4147
+ required: ["invoiceNumber", "totalAmount"]
4123
4148
  }
4124
- }
4125
- },
4126
- required: ["vendorName", "totalAmount"]
4127
- })
4149
+ } },
4150
+ required: ["invoices"]
4151
+ })
4152
+ }
4128
4153
  }
4129
- } };
4154
+ };
4130
4155
  const extract = oc.route({
4131
4156
  summary: "Extract structured data from an invoice",
4132
- description: `Parse an invoice 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.`,
4157
+ description: `Parse an invoice 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. For a file that holds several invoices, make the schema an object with an array property of invoice objects (see the "Many invoices in one PDF" example) to get one item per invoice.`,
4133
4158
  tags: ["Invoice"],
4134
4159
  spec: (op) => {
4135
4160
  const spec = getDefaultSpec(op, requestExamples$1);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pdfvector/client",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Official TypeScript/JavaScript SDK for PDF Vector API",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/phuctm97/pdfvector.git",
9
+ "url": "git+https://github.com/orchestero/pdfvector.git",
10
10
  "directory": "packages/client"
11
11
  },
12
12
  "homepage": "https://pdfvector.com",