@deepcitation/deepcitation-js 1.1.38 → 1.1.39

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/README.md CHANGED
@@ -66,7 +66,7 @@ import { DeepCitation, wrapCitationPrompt } from "@deepcitation/deepcitation-js"
66
66
  const dc = new DeepCitation({ apiKey: process.env.DEEPCITATION_API_KEY });
67
67
 
68
68
  // Upload source files, this can be done before the user types their prompt
69
- const { fileDataParts, deepTextPromptPortion } = await dc.prepareFiles([
69
+ const { fileDataParts, deepTextPromptPortion } = await deepcitation.prepareFiles([
70
70
  { file: pdfBuffer, filename: "report.pdf" },
71
71
  ]);
72
72
 
@@ -91,7 +91,7 @@ const response = await llm.chat({
91
91
  Verify citations against the source documents.
92
92
 
93
93
  ```typescript
94
- const result = await dc.verifyAll({
94
+ const result = await deepcitation.verify({
95
95
  llmOutput: response.content,
96
96
  });
97
97
 
@@ -149,16 +149,16 @@ const dc = new DeepCitation({
149
149
  });
150
150
 
151
151
  // Upload and prepare source files
152
- await dc.prepareFiles(files: FileInput[])
152
+ await deepcitation.prepareFiles(files: FileInput[])
153
153
 
154
154
  // Convert URLs/Office docs to PDF
155
- await dc.convertToPdf(urlOrOptions: string | ConvertOptions)
155
+ await deepcitation.convertToPdf(urlOrOptions: string | ConvertOptions)
156
156
 
157
- // Verify LLM citations (parse and verify all)
158
- await dc.verifyAll({ llmOutput, outputImageFormat? })
157
+ // Verify LLM citations (recommended - parses and verifies all)
158
+ await deepcitation.verify({ llmOutput, outputImageFormat? })
159
159
 
160
- // Verify pre-parsed citations against a specific file
161
- await dc.verify(attachmentId, citations, options?)
160
+ // Verify pre-parsed citations against a specific attachment
161
+ await deepcitation.verifyAttachment(attachmentId, citations, options?)
162
162
  ```
163
163
 
164
164
  ### Prompt Utilities
@@ -1,2 +1,2 @@
1
- import {j,u}from'./chunk-UC6YB63U.js';import {a}from'./chunk-O2XFH626.js';var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var y=class{constructor(t){a(this,"apiKey");a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verify(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=j(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=j(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verifyAll(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=u(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verify(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
2
- export{y as a};
1
+ import {j,u}from'./chunk-UC6YB63U.js';import {a}from'./chunk-O2XFH626.js';var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var h=class{constructor(t){a(this,"apiKey");a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verifyAttachment(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=j(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=j(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verify(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=u(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verifyAttachment(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
2
+ export{h as a};
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk6VPT3IIK_cjs=require('./chunk-6VPT3IIK.cjs'),chunkF2MMVEVC_cjs=require('./chunk-F2MMVEVC.cjs');var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var y=class{constructor(t){chunkF2MMVEVC_cjs.a(this,"apiKey");chunkF2MMVEVC_cjs.a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verify(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=chunk6VPT3IIK_cjs.j(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=chunk6VPT3IIK_cjs.j(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verifyAll(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=chunk6VPT3IIK_cjs.u(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verify(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
2
- exports.a=y;
1
+ 'use strict';var chunk6VPT3IIK_cjs=require('./chunk-6VPT3IIK.cjs'),chunkF2MMVEVC_cjs=require('./chunk-F2MMVEVC.cjs');var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var h=class{constructor(t){chunkF2MMVEVC_cjs.a(this,"apiKey");chunkF2MMVEVC_cjs.a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verifyAttachment(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=chunk6VPT3IIK_cjs.j(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=chunk6VPT3IIK_cjs.j(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verify(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=chunk6VPT3IIK_cjs.u(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verifyAttachment(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
2
+ exports.a=h;
@@ -1 +1 @@
1
- 'use strict';var chunkGWKSW26H_cjs=require('../chunk-GWKSW26H.cjs');require('../chunk-6VPT3IIK.cjs'),require('../chunk-F2MMVEVC.cjs');Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkGWKSW26H_cjs.a}});
1
+ 'use strict';var chunkTBG42N5V_cjs=require('../chunk-TBG42N5V.cjs');require('../chunk-6VPT3IIK.cjs'),require('../chunk-F2MMVEVC.cjs');Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkTBG42N5V_cjs.a}});
@@ -101,9 +101,9 @@ interface PrepareFilesResult {
101
101
  deepTextPromptPortion: string[];
102
102
  }
103
103
  /**
104
- * Input for verifyCitationsFromLlmOutput
104
+ * Input for verify method
105
105
  */
106
- interface VerifyCitationsFromLlmOutput {
106
+ interface VerifyInput {
107
107
  /** The LLM response containing citations */
108
108
  llmOutput: string;
109
109
  /** Optional file references (required for Zero Data Retention or after storage expires) */
@@ -111,6 +111,10 @@ interface VerifyCitationsFromLlmOutput {
111
111
  /** Output image format for verification screenshots */
112
112
  outputImageFormat?: "jpeg" | "png" | "avif";
113
113
  }
114
+ /**
115
+ * @deprecated Use VerifyInput instead. This alias is kept for backwards compatibility.
116
+ */
117
+ type verifyAll = VerifyInput;
114
118
  /**
115
119
  * Input for convertFile - convert URL or Office file to PDF
116
120
  */
@@ -164,7 +168,7 @@ interface PrepareConvertedFileOptions {
164
168
  * const dc = new DeepCitation({ apiKey: process.env.DEEPCITATION_API_KEY });
165
169
  *
166
170
  * // Upload a file
167
- * const { attachmentId, promptContent } = await dc.uploadFile(file);
171
+ * const { attachmentId, promptContent } = await deepcitation.uploadFile(file);
168
172
  *
169
173
  * // Include promptContent in your LLM messages
170
174
  * const response = await llm.chat({
@@ -176,7 +180,7 @@ interface PrepareConvertedFileOptions {
176
180
  *
177
181
  * // Verify citations in the LLM output
178
182
  * const citations = getAllCitationsFromLlmOutput(response);
179
- * const verified = await dc.verifyCitations(attachmentId, citations);
183
+ * const verified = await deepcitation.verifyCitations(attachmentId, citations);
180
184
  * ```
181
185
  */
182
186
  declare class DeepCitation {
@@ -205,11 +209,11 @@ declare class DeepCitation {
205
209
  * ```typescript
206
210
  * // Browser with File object
207
211
  * const file = document.querySelector('input[type="file"]').files[0];
208
- * const result = await dc.uploadFile(file);
212
+ * const result = await deepcitation.uploadFile(file);
209
213
  *
210
214
  * // Node.js with Buffer
211
215
  * const buffer = fs.readFileSync('document.pdf');
212
- * const result = await dc.uploadFile(buffer, { filename: 'document.pdf' });
216
+ * const result = await deepcitation.uploadFile(buffer, { filename: 'document.pdf' });
213
217
  * ```
214
218
  */
215
219
  uploadFile(file: File | Blob | Buffer, options?: UploadFileOptions): Promise<UploadFileResponse>;
@@ -231,16 +235,16 @@ declare class DeepCitation {
231
235
  * @example
232
236
  * ```typescript
233
237
  * // Convert a URL to PDF
234
- * const result = await dc.convertToPdf({ url: "https://example.com/article" });
238
+ * const result = await deepcitation.convertToPdf({ url: "https://example.com/article" });
235
239
  *
236
240
  * // Convert an Office document
237
- * const result = await dc.convertToPdf({
241
+ * const result = await deepcitation.convertToPdf({
238
242
  * file: docxBuffer,
239
243
  * filename: "report.docx"
240
244
  * });
241
245
  *
242
246
  * // Then prepare the file for verification
243
- * const { deepTextPromptPortion, attachmentId } = await dc.prepareConvertedFile({
247
+ * const { deepTextPromptPortion, attachmentId } = await deepcitation.prepareConvertedFile({
244
248
  * attachmentId: result.attachmentId
245
249
  * });
246
250
  * ```
@@ -256,10 +260,10 @@ declare class DeepCitation {
256
260
  * @example
257
261
  * ```typescript
258
262
  * // First convert the file
259
- * const converted = await dc.convertToPdf({ url: "https://example.com/article" });
263
+ * const converted = await deepcitation.convertToPdf({ url: "https://example.com/article" });
260
264
  *
261
265
  * // Then prepare it for verification
262
- * const { deepTextPromptPortion, attachmentId } = await dc.prepareConvertedFile({
266
+ * const { deepTextPromptPortion, attachmentId } = await deepcitation.prepareConvertedFile({
263
267
  * attachmentId: converted.attachmentId
264
268
  * });
265
269
  *
@@ -276,7 +280,7 @@ declare class DeepCitation {
276
280
  *
277
281
  * @example
278
282
  * ```typescript
279
- * const { fileDataParts, deepTextPromptPortion } = await dc.prepareFiles([
283
+ * const { fileDataParts, deepTextPromptPortion } = await deepcitation.prepareFiles([
280
284
  * { file: pdfBuffer, filename: "report.pdf" },
281
285
  * { file: invoiceBuffer, filename: "invoice.pdf" },
282
286
  * ]);
@@ -289,12 +293,16 @@ declare class DeepCitation {
289
293
  * });
290
294
  *
291
295
  * // Use fileDataParts later for verification
292
- * const result = await dc.verifyCitationsFromLlmOutput({ llmOutput, fileDataParts });
296
+ * const result = await deepcitation.verifyAll({ llmOutput, fileDataParts });
293
297
  * ```
294
298
  */
295
299
  prepareFiles(files: FileInput[]): Promise<PrepareFilesResult>;
296
300
  /**
297
- * Verify citations against a previously uploaded file.
301
+ * Verify citations against a single attachment/file.
302
+ *
303
+ * For most use cases, prefer `verify()` which automatically parses citations
304
+ * from LLM output and handles multiple attachments. Use this method when you
305
+ * need fine-grained control over per-attachment verification.
298
306
  *
299
307
  * @param attachmentId - The attachment ID returned from uploadFile
300
308
  * @param citations - Citations to verify (from getAllCitationsFromLlmOutput)
@@ -306,7 +314,7 @@ declare class DeepCitation {
306
314
  * import { getAllCitationsFromLlmOutput } from '@deepcitation/deepcitation-js';
307
315
  *
308
316
  * const citations = getAllCitationsFromLlmOutput(llmResponse);
309
- * const verified = await dc.verify(attachmentId, citations);
317
+ * const verified = await deepcitation.verifyAttachment(attachmentId, citations);
310
318
  *
311
319
  * for (const [key, result] of Object.entries(verified.verifications)) {
312
320
  * console.log(key, result.status);
@@ -314,17 +322,26 @@ declare class DeepCitation {
314
322
  * }
315
323
  * ```
316
324
  */
317
- verify(attachmentId: string, citations: CitationInput, options?: VerifyCitationsOptions): Promise<VerifyCitationsResponse>;
325
+ verifyAttachment(attachmentId: string, citations: CitationInput, options?: VerifyCitationsOptions): Promise<VerifyCitationsResponse>;
318
326
  /**
319
327
  * Parse and verify all citations from LLM output.
320
- * This is the recommended way to verify citations for new integrations.
328
+ *
329
+ * This is the recommended method for citation verification. It automatically:
330
+ * 1. Parses citations from LLM output (no raw content sent to our servers)
331
+ * 2. Groups citations by attachment ID
332
+ * 3. Verifies each attachment in parallel
333
+ *
334
+ * For privacy-conscious users: we only receive the parsed citation metadata,
335
+ * not your raw LLM output. This method is a convenience wrapper that parses
336
+ * locally and makes per-attachment verification calls.
321
337
  *
322
338
  * @param input - Object containing llmOutput and optional outputImageFormat
339
+ * @param citations - Optional pre-parsed citations (skips parsing if provided)
323
340
  * @returns Verification results with status and proof images
324
341
  *
325
342
  * @example
326
343
  * ```typescript
327
- * const result = await dc.verifyAll({
344
+ * const result = await deepcitation.verify({
328
345
  * llmOutput: response.content,
329
346
  * });
330
347
  *
@@ -333,9 +350,9 @@ declare class DeepCitation {
333
350
  * }
334
351
  * ```
335
352
  */
336
- verifyAll(input: VerifyCitationsFromLlmOutput, citations?: {
353
+ verify(input: VerifyInput, citations?: {
337
354
  [key: string]: Citation;
338
355
  }): Promise<VerifyCitationsResponse>;
339
356
  }
340
357
 
341
- export { type CitationInput, type ConvertFileInput, type ConvertFileResponse, DeepCitation, type DeepCitationConfig, type FileDataPart, type FileInput, type PrepareConvertedFileOptions, type PrepareFilesResult, type UploadFileOptions, type UploadFileResponse, type VerifyCitationsFromLlmOutput, type VerifyCitationsOptions, type VerifyCitationsResponse };
358
+ export { type CitationInput, type ConvertFileInput, type ConvertFileResponse, DeepCitation, type DeepCitationConfig, type FileDataPart, type FileInput, type PrepareConvertedFileOptions, type PrepareFilesResult, type UploadFileOptions, type UploadFileResponse, type VerifyCitationsOptions, type VerifyCitationsResponse, type VerifyInput, type verifyAll };
@@ -101,9 +101,9 @@ interface PrepareFilesResult {
101
101
  deepTextPromptPortion: string[];
102
102
  }
103
103
  /**
104
- * Input for verifyCitationsFromLlmOutput
104
+ * Input for verify method
105
105
  */
106
- interface VerifyCitationsFromLlmOutput {
106
+ interface VerifyInput {
107
107
  /** The LLM response containing citations */
108
108
  llmOutput: string;
109
109
  /** Optional file references (required for Zero Data Retention or after storage expires) */
@@ -111,6 +111,10 @@ interface VerifyCitationsFromLlmOutput {
111
111
  /** Output image format for verification screenshots */
112
112
  outputImageFormat?: "jpeg" | "png" | "avif";
113
113
  }
114
+ /**
115
+ * @deprecated Use VerifyInput instead. This alias is kept for backwards compatibility.
116
+ */
117
+ type verifyAll = VerifyInput;
114
118
  /**
115
119
  * Input for convertFile - convert URL or Office file to PDF
116
120
  */
@@ -164,7 +168,7 @@ interface PrepareConvertedFileOptions {
164
168
  * const dc = new DeepCitation({ apiKey: process.env.DEEPCITATION_API_KEY });
165
169
  *
166
170
  * // Upload a file
167
- * const { attachmentId, promptContent } = await dc.uploadFile(file);
171
+ * const { attachmentId, promptContent } = await deepcitation.uploadFile(file);
168
172
  *
169
173
  * // Include promptContent in your LLM messages
170
174
  * const response = await llm.chat({
@@ -176,7 +180,7 @@ interface PrepareConvertedFileOptions {
176
180
  *
177
181
  * // Verify citations in the LLM output
178
182
  * const citations = getAllCitationsFromLlmOutput(response);
179
- * const verified = await dc.verifyCitations(attachmentId, citations);
183
+ * const verified = await deepcitation.verifyCitations(attachmentId, citations);
180
184
  * ```
181
185
  */
182
186
  declare class DeepCitation {
@@ -205,11 +209,11 @@ declare class DeepCitation {
205
209
  * ```typescript
206
210
  * // Browser with File object
207
211
  * const file = document.querySelector('input[type="file"]').files[0];
208
- * const result = await dc.uploadFile(file);
212
+ * const result = await deepcitation.uploadFile(file);
209
213
  *
210
214
  * // Node.js with Buffer
211
215
  * const buffer = fs.readFileSync('document.pdf');
212
- * const result = await dc.uploadFile(buffer, { filename: 'document.pdf' });
216
+ * const result = await deepcitation.uploadFile(buffer, { filename: 'document.pdf' });
213
217
  * ```
214
218
  */
215
219
  uploadFile(file: File | Blob | Buffer, options?: UploadFileOptions): Promise<UploadFileResponse>;
@@ -231,16 +235,16 @@ declare class DeepCitation {
231
235
  * @example
232
236
  * ```typescript
233
237
  * // Convert a URL to PDF
234
- * const result = await dc.convertToPdf({ url: "https://example.com/article" });
238
+ * const result = await deepcitation.convertToPdf({ url: "https://example.com/article" });
235
239
  *
236
240
  * // Convert an Office document
237
- * const result = await dc.convertToPdf({
241
+ * const result = await deepcitation.convertToPdf({
238
242
  * file: docxBuffer,
239
243
  * filename: "report.docx"
240
244
  * });
241
245
  *
242
246
  * // Then prepare the file for verification
243
- * const { deepTextPromptPortion, attachmentId } = await dc.prepareConvertedFile({
247
+ * const { deepTextPromptPortion, attachmentId } = await deepcitation.prepareConvertedFile({
244
248
  * attachmentId: result.attachmentId
245
249
  * });
246
250
  * ```
@@ -256,10 +260,10 @@ declare class DeepCitation {
256
260
  * @example
257
261
  * ```typescript
258
262
  * // First convert the file
259
- * const converted = await dc.convertToPdf({ url: "https://example.com/article" });
263
+ * const converted = await deepcitation.convertToPdf({ url: "https://example.com/article" });
260
264
  *
261
265
  * // Then prepare it for verification
262
- * const { deepTextPromptPortion, attachmentId } = await dc.prepareConvertedFile({
266
+ * const { deepTextPromptPortion, attachmentId } = await deepcitation.prepareConvertedFile({
263
267
  * attachmentId: converted.attachmentId
264
268
  * });
265
269
  *
@@ -276,7 +280,7 @@ declare class DeepCitation {
276
280
  *
277
281
  * @example
278
282
  * ```typescript
279
- * const { fileDataParts, deepTextPromptPortion } = await dc.prepareFiles([
283
+ * const { fileDataParts, deepTextPromptPortion } = await deepcitation.prepareFiles([
280
284
  * { file: pdfBuffer, filename: "report.pdf" },
281
285
  * { file: invoiceBuffer, filename: "invoice.pdf" },
282
286
  * ]);
@@ -289,12 +293,16 @@ declare class DeepCitation {
289
293
  * });
290
294
  *
291
295
  * // Use fileDataParts later for verification
292
- * const result = await dc.verifyCitationsFromLlmOutput({ llmOutput, fileDataParts });
296
+ * const result = await deepcitation.verifyAll({ llmOutput, fileDataParts });
293
297
  * ```
294
298
  */
295
299
  prepareFiles(files: FileInput[]): Promise<PrepareFilesResult>;
296
300
  /**
297
- * Verify citations against a previously uploaded file.
301
+ * Verify citations against a single attachment/file.
302
+ *
303
+ * For most use cases, prefer `verify()` which automatically parses citations
304
+ * from LLM output and handles multiple attachments. Use this method when you
305
+ * need fine-grained control over per-attachment verification.
298
306
  *
299
307
  * @param attachmentId - The attachment ID returned from uploadFile
300
308
  * @param citations - Citations to verify (from getAllCitationsFromLlmOutput)
@@ -306,7 +314,7 @@ declare class DeepCitation {
306
314
  * import { getAllCitationsFromLlmOutput } from '@deepcitation/deepcitation-js';
307
315
  *
308
316
  * const citations = getAllCitationsFromLlmOutput(llmResponse);
309
- * const verified = await dc.verify(attachmentId, citations);
317
+ * const verified = await deepcitation.verifyAttachment(attachmentId, citations);
310
318
  *
311
319
  * for (const [key, result] of Object.entries(verified.verifications)) {
312
320
  * console.log(key, result.status);
@@ -314,17 +322,26 @@ declare class DeepCitation {
314
322
  * }
315
323
  * ```
316
324
  */
317
- verify(attachmentId: string, citations: CitationInput, options?: VerifyCitationsOptions): Promise<VerifyCitationsResponse>;
325
+ verifyAttachment(attachmentId: string, citations: CitationInput, options?: VerifyCitationsOptions): Promise<VerifyCitationsResponse>;
318
326
  /**
319
327
  * Parse and verify all citations from LLM output.
320
- * This is the recommended way to verify citations for new integrations.
328
+ *
329
+ * This is the recommended method for citation verification. It automatically:
330
+ * 1. Parses citations from LLM output (no raw content sent to our servers)
331
+ * 2. Groups citations by attachment ID
332
+ * 3. Verifies each attachment in parallel
333
+ *
334
+ * For privacy-conscious users: we only receive the parsed citation metadata,
335
+ * not your raw LLM output. This method is a convenience wrapper that parses
336
+ * locally and makes per-attachment verification calls.
321
337
  *
322
338
  * @param input - Object containing llmOutput and optional outputImageFormat
339
+ * @param citations - Optional pre-parsed citations (skips parsing if provided)
323
340
  * @returns Verification results with status and proof images
324
341
  *
325
342
  * @example
326
343
  * ```typescript
327
- * const result = await dc.verifyAll({
344
+ * const result = await deepcitation.verify({
328
345
  * llmOutput: response.content,
329
346
  * });
330
347
  *
@@ -333,9 +350,9 @@ declare class DeepCitation {
333
350
  * }
334
351
  * ```
335
352
  */
336
- verifyAll(input: VerifyCitationsFromLlmOutput, citations?: {
353
+ verify(input: VerifyInput, citations?: {
337
354
  [key: string]: Citation;
338
355
  }): Promise<VerifyCitationsResponse>;
339
356
  }
340
357
 
341
- export { type CitationInput, type ConvertFileInput, type ConvertFileResponse, DeepCitation, type DeepCitationConfig, type FileDataPart, type FileInput, type PrepareConvertedFileOptions, type PrepareFilesResult, type UploadFileOptions, type UploadFileResponse, type VerifyCitationsFromLlmOutput, type VerifyCitationsOptions, type VerifyCitationsResponse };
358
+ export { type CitationInput, type ConvertFileInput, type ConvertFileResponse, DeepCitation, type DeepCitationConfig, type FileDataPart, type FileInput, type PrepareConvertedFileOptions, type PrepareFilesResult, type UploadFileOptions, type UploadFileResponse, type VerifyCitationsOptions, type VerifyCitationsResponse, type VerifyInput, type verifyAll };
@@ -1 +1 @@
1
- export{a as DeepCitation}from'../chunk-BBXTVCT5.js';import'../chunk-UC6YB63U.js';import'../chunk-O2XFH626.js';
1
+ export{a as DeepCitation}from'../chunk-L3IBEKR4.js';import'../chunk-UC6YB63U.js';import'../chunk-O2XFH626.js';
package/lib/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkGWKSW26H_cjs=require('./chunk-GWKSW26H.cjs'),chunkHAYHSRVD_cjs=require('./chunk-HAYHSRVD.cjs'),chunkCFXDRAJL_cjs=require('./chunk-CFXDRAJL.cjs'),chunk6VPT3IIK_cjs=require('./chunk-6VPT3IIK.cjs');require('./chunk-F2MMVEVC.cjs');var Y=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function z(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,m,n=[];for(;(m=r.exec(t))!==null;)n.push(m.index);if(n.length<2)return t;let c=n[n.length-1],f=n[n.length-2],o=t.substring(f+1,c+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let I=0,s=c+1;t.endsWith(o)&&(s=t.length);let C=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)I++,C=i,s=i;else break}return I>=e?t.substring(0,C)+o:t}Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkGWKSW26H_cjs.a}});Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.e}});Object.defineProperty(exports,"BLANK_VERIFICATION",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.d}});Object.defineProperty(exports,"DEFAULT_OUTPUT_IMAGE_FORMAT",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.a}});Object.defineProperty(exports,"NOT_FOUND_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.b}});Object.defineProperty(exports,"PENDING_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.c}});Object.defineProperty(exports,"CITATION_X_PADDING",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.q}});Object.defineProperty(exports,"CITATION_Y_PADDING",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.r}});Object.defineProperty(exports,"generateCitationInstanceId",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.l}});Object.defineProperty(exports,"generateCitationKey",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.j}});Object.defineProperty(exports,"generateVerificationKey",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.k}});Object.defineProperty(exports,"getAllCitationsFromLlmOutput",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.u}});Object.defineProperty(exports,"getCitationPageNumber",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.e}});Object.defineProperty(exports,"getCitationStatus",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.s}});Object.defineProperty(exports,"groupCitationsByAttachmentId",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.v}});Object.defineProperty(exports,"groupCitationsByAttachmentIdObject",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.w}});Object.defineProperty(exports,"normalizeCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.f}});Object.defineProperty(exports,"parseCitation",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.t}});Object.defineProperty(exports,"removeCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.b}});Object.defineProperty(exports,"removeLineIdMetadata",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.d}});Object.defineProperty(exports,"removePageNumberMetadata",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.c}});Object.defineProperty(exports,"replaceCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.a}});Object.defineProperty(exports,"sha1Hash",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.g}});exports.cleanRepeatingLastSentence=z;exports.isGeminiGarbage=Y;
1
+ 'use strict';var chunkTBG42N5V_cjs=require('./chunk-TBG42N5V.cjs'),chunkHAYHSRVD_cjs=require('./chunk-HAYHSRVD.cjs'),chunkCFXDRAJL_cjs=require('./chunk-CFXDRAJL.cjs'),chunk6VPT3IIK_cjs=require('./chunk-6VPT3IIK.cjs');require('./chunk-F2MMVEVC.cjs');var Y=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function z(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,c,n=[];for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let m=n[n.length-1],l=n[n.length-2],o=t.substring(l+1,m+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let I=0,s=m+1;t.endsWith(o)&&(s=t.length);let f=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)I++,f=i,s=i;else break}return I>=e?t.substring(0,f)+o:t}Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkTBG42N5V_cjs.a}});Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.e}});Object.defineProperty(exports,"BLANK_VERIFICATION",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.d}});Object.defineProperty(exports,"DEFAULT_OUTPUT_IMAGE_FORMAT",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.a}});Object.defineProperty(exports,"NOT_FOUND_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.b}});Object.defineProperty(exports,"PENDING_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.c}});Object.defineProperty(exports,"CITATION_X_PADDING",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.q}});Object.defineProperty(exports,"CITATION_Y_PADDING",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.r}});Object.defineProperty(exports,"generateCitationInstanceId",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.l}});Object.defineProperty(exports,"generateCitationKey",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.j}});Object.defineProperty(exports,"generateVerificationKey",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.k}});Object.defineProperty(exports,"getAllCitationsFromLlmOutput",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.u}});Object.defineProperty(exports,"getCitationPageNumber",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.e}});Object.defineProperty(exports,"getCitationStatus",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.s}});Object.defineProperty(exports,"groupCitationsByAttachmentId",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.v}});Object.defineProperty(exports,"groupCitationsByAttachmentIdObject",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.w}});Object.defineProperty(exports,"normalizeCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.f}});Object.defineProperty(exports,"parseCitation",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.t}});Object.defineProperty(exports,"removeCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.b}});Object.defineProperty(exports,"removeLineIdMetadata",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.d}});Object.defineProperty(exports,"removePageNumberMetadata",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.c}});Object.defineProperty(exports,"replaceCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.a}});Object.defineProperty(exports,"sha1Hash",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.g}});exports.cleanRepeatingLastSentence=z;exports.isGeminiGarbage=Y;
package/lib/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { CitationInput, DeepCitation, DeepCitationConfig, FileDataPart, FileInput, PrepareFilesResult, UploadFileOptions, UploadFileResponse, VerifyCitationsFromLlmOutput, VerifyCitationsOptions, VerifyCitationsResponse } from './client/index.cjs';
1
+ export { CitationInput, DeepCitation, DeepCitationConfig, FileDataPart, FileInput, PrepareFilesResult, UploadFileOptions, UploadFileResponse, VerifyCitationsOptions, VerifyCitationsResponse, verifyAll } from './client/index.cjs';
2
2
  import { C as Citation, V as Verification, a as CitationStatus } from './index-C7uqFhag.cjs';
3
3
  export { B as BLANK_VERIFICATION, b as CitationType, f as ContentMatchStatus, D as DEFAULT_OUTPUT_IMAGE_FORMAT, I as IVertex, N as NOT_FOUND_VERIFICATION_INDEX, O as OutputImageFormat, P as PENDING_VERIFICATION_INDEX, k as PdfSpaceItem, j as ScreenBox, i as SearchAttempt, h as SearchMethod, g as SearchStatus, e as SourceMeta, S as SourceType, U as UrlAccessStatus, c as VerifyCitationRequest, d as VerifyCitationResponse } from './index-C7uqFhag.cjs';
4
4
  export { C as CITATION_X_PADDING, c as CITATION_Y_PADDING, b as generateCitationInstanceId, g as generateCitationKey, a as generateVerificationKey } from './utils-CoKeVmTp.cjs';
@@ -45,7 +45,7 @@ declare const getAllCitationsFromLlmOutput: (llmOutput: any) => {
45
45
  *
46
46
  * // Verify citations for each file
47
47
  * for (const [attachmentId, fileCitations] of citationsByAttachment) {
48
- * const verified = await dc.verifyCitations(attachmentId, fileCitations);
48
+ * const verified = await deepcitation.verifyCitations(attachmentId, fileCitations);
49
49
  * // Process verification results...
50
50
  * }
51
51
  * ```
@@ -69,7 +69,7 @@ declare function groupCitationsByAttachmentId(citations: Citation[] | {
69
69
  *
70
70
  * // Verify citations for each file using Promise.all
71
71
  * const verificationPromises = Object.entries(citationsByAttachment).map(
72
- * ([attachmentId, fileCitations]) => dc.verifyCitations(attachmentId, fileCitations)
72
+ * ([attachmentId, fileCitations]) => deepcitation.verifyCitations(attachmentId, fileCitations)
73
73
  * );
74
74
  * const results = await Promise.all(verificationPromises);
75
75
  * ```
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { CitationInput, DeepCitation, DeepCitationConfig, FileDataPart, FileInput, PrepareFilesResult, UploadFileOptions, UploadFileResponse, VerifyCitationsFromLlmOutput, VerifyCitationsOptions, VerifyCitationsResponse } from './client/index.js';
1
+ export { CitationInput, DeepCitation, DeepCitationConfig, FileDataPart, FileInput, PrepareFilesResult, UploadFileOptions, UploadFileResponse, VerifyCitationsOptions, VerifyCitationsResponse, verifyAll } from './client/index.js';
2
2
  import { C as Citation, V as Verification, a as CitationStatus } from './index-C7uqFhag.js';
3
3
  export { B as BLANK_VERIFICATION, b as CitationType, f as ContentMatchStatus, D as DEFAULT_OUTPUT_IMAGE_FORMAT, I as IVertex, N as NOT_FOUND_VERIFICATION_INDEX, O as OutputImageFormat, P as PENDING_VERIFICATION_INDEX, k as PdfSpaceItem, j as ScreenBox, i as SearchAttempt, h as SearchMethod, g as SearchStatus, e as SourceMeta, S as SourceType, U as UrlAccessStatus, c as VerifyCitationRequest, d as VerifyCitationResponse } from './index-C7uqFhag.js';
4
4
  export { C as CITATION_X_PADDING, c as CITATION_Y_PADDING, b as generateCitationInstanceId, g as generateCitationKey, a as generateVerificationKey } from './utils-C39-42U2.js';
@@ -45,7 +45,7 @@ declare const getAllCitationsFromLlmOutput: (llmOutput: any) => {
45
45
  *
46
46
  * // Verify citations for each file
47
47
  * for (const [attachmentId, fileCitations] of citationsByAttachment) {
48
- * const verified = await dc.verifyCitations(attachmentId, fileCitations);
48
+ * const verified = await deepcitation.verifyCitations(attachmentId, fileCitations);
49
49
  * // Process verification results...
50
50
  * }
51
51
  * ```
@@ -69,7 +69,7 @@ declare function groupCitationsByAttachmentId(citations: Citation[] | {
69
69
  *
70
70
  * // Verify citations for each file using Promise.all
71
71
  * const verificationPromises = Object.entries(citationsByAttachment).map(
72
- * ([attachmentId, fileCitations]) => dc.verifyCitations(attachmentId, fileCitations)
72
+ * ([attachmentId, fileCitations]) => deepcitation.verifyCitations(attachmentId, fileCitations)
73
73
  * );
74
74
  * const results = await Promise.all(verificationPromises);
75
75
  * ```
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{a as DeepCitation}from'./chunk-BBXTVCT5.js';export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'./chunk-YZ6QJQP5.js';export{d as BLANK_VERIFICATION,a as DEFAULT_OUTPUT_IMAGE_FORMAT,b as NOT_FOUND_VERIFICATION_INDEX,c as PENDING_VERIFICATION_INDEX}from'./chunk-RQPZSRID.js';export{q as CITATION_X_PADDING,r as CITATION_Y_PADDING,l as generateCitationInstanceId,j as generateCitationKey,k as generateVerificationKey,u as getAllCitationsFromLlmOutput,e as getCitationPageNumber,s as getCitationStatus,v as groupCitationsByAttachmentId,w as groupCitationsByAttachmentIdObject,f as normalizeCitations,t as parseCitation,b as removeCitations,d as removeLineIdMetadata,c as removePageNumberMetadata,a as replaceCitations,g as sha1Hash}from'./chunk-UC6YB63U.js';import'./chunk-O2XFH626.js';var Y=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function z(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,m,n=[];for(;(m=r.exec(t))!==null;)n.push(m.index);if(n.length<2)return t;let c=n[n.length-1],f=n[n.length-2],o=t.substring(f+1,c+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let I=0,s=c+1;t.endsWith(o)&&(s=t.length);let C=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)I++,C=i,s=i;else break}return I>=e?t.substring(0,C)+o:t}export{z as cleanRepeatingLastSentence,Y as isGeminiGarbage};
1
+ export{a as DeepCitation}from'./chunk-L3IBEKR4.js';export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'./chunk-YZ6QJQP5.js';export{d as BLANK_VERIFICATION,a as DEFAULT_OUTPUT_IMAGE_FORMAT,b as NOT_FOUND_VERIFICATION_INDEX,c as PENDING_VERIFICATION_INDEX}from'./chunk-RQPZSRID.js';export{q as CITATION_X_PADDING,r as CITATION_Y_PADDING,l as generateCitationInstanceId,j as generateCitationKey,k as generateVerificationKey,u as getAllCitationsFromLlmOutput,e as getCitationPageNumber,s as getCitationStatus,v as groupCitationsByAttachmentId,w as groupCitationsByAttachmentIdObject,f as normalizeCitations,t as parseCitation,b as removeCitations,d as removeLineIdMetadata,c as removePageNumberMetadata,a as replaceCitations,g as sha1Hash}from'./chunk-UC6YB63U.js';import'./chunk-O2XFH626.js';var Y=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function z(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,c,n=[];for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let m=n[n.length-1],l=n[n.length-2],o=t.substring(l+1,m+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let I=0,s=m+1;t.endsWith(o)&&(s=t.length);let f=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)I++,f=i,s=i;else break}return I>=e?t.substring(0,f)+o:t}export{z as cleanRepeatingLastSentence,Y as isGeminiGarbage};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepcitation/deepcitation-js",
3
- "version": "1.1.38",
3
+ "version": "1.1.39",
4
4
  "description": "DeepCitation JavaScript SDK for deterministic AI citation verification",
5
5
  "type": "module",
6
6
  "private": false,