@deepcitation/deepcitation-js 1.0.7 → 1.0.8

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.
@@ -1,5 +1,5 @@
1
- import type { Citation } from "../types/index";
2
- import type { CitationInput, ConvertFileInput, ConvertFileResponse, DeepCitationConfig, FileInput, PrepareConvertedFileOptions, PrepareFilesResult, UploadFileOptions, UploadFileResponse, VerifyCitationsFromLlmOutput, VerifyCitationsOptions, VerifyCitationsResponse } from "./types";
1
+ import type { Citation } from "../types/index.js";
2
+ import type { CitationInput, ConvertFileInput, ConvertFileResponse, DeepCitationConfig, FileInput, PrepareConvertedFileOptions, PrepareFilesResult, UploadFileOptions, UploadFileResponse, VerifyCitationsFromLlmOutput, VerifyCitationsOptions, VerifyCitationsResponse } from "./types.js";
3
3
  /**
4
4
  * DeepCitation client for file upload and citation verification.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { getAllCitationsFromLlmOutput } from "../parsing/parseCitation";
2
- import { generateCitationKey } from "../react/utils";
1
+ import { getAllCitationsFromLlmOutput } from "../parsing/parseCitation.js";
2
+ import { generateCitationKey } from "../react/utils.js";
3
3
  const DEFAULT_API_URL = "https://api.deepcitation.com";
4
4
  /** Convert File/Blob/Buffer to a Blob suitable for FormData */
5
5
  function toBlob(file, filename) {
@@ -1,2 +1,2 @@
1
- export { DeepCitation } from "./DeepCitation";
2
- export type { DeepCitationConfig, UploadFileResponse, UploadFileOptions, VerifyCitationsResponse, VerifyCitationsOptions, CitationInput, FileInput, FileDataPart, PrepareFilesResult, VerifyCitationsFromLlmOutput, ConvertFileInput, ConvertFileResponse, PrepareConvertedFileOptions, } from "./types";
1
+ export { DeepCitation } from "./DeepCitation.js";
2
+ export type { DeepCitationConfig, UploadFileResponse, UploadFileOptions, VerifyCitationsResponse, VerifyCitationsOptions, CitationInput, FileInput, FileDataPart, PrepareFilesResult, VerifyCitationsFromLlmOutput, ConvertFileInput, ConvertFileResponse, PrepareConvertedFileOptions, } from "./types.js";
@@ -1 +1 @@
1
- export { DeepCitation } from "./DeepCitation";
1
+ export { DeepCitation } from "./DeepCitation.js";
@@ -1,4 +1,4 @@
1
- import type { Citation, FoundHighlightLocation } from "../types/index";
1
+ import type { Citation, FoundHighlightLocation } from "../types/index.js";
2
2
  /**
3
3
  * Configuration options for the DeepCitation client
4
4
  */
@@ -1,4 +1,4 @@
1
- export declare const CITATION_MARKDOWN_SYNTAX_PROMPT = "\nCitation syntax to use within Markdown:\n\u2022 To support any ideas or information that requires a citation from the provided content, use the following citation syntax:\n<cite file_id='file_id' start_page_key='page_number_PAGE_index_INDEX' full_phrase='the verbatim text of the terse phrase inside <file_text />; remember to escape quotes and newlines inside the full_phrase to remain as valid JSON' key_span='the verbatim value or words within full_phrase that best support the citation' line_ids='2-6' reasoning='the terse logic used to conclude the citation' />\n\n\u2022 Very important: for page numbers, only use the page number and page index info from the page_number_PAGE_index_INDEX format (e.g. <page_number_1_index_0>) and never from the contents inside the page.\n\u2022 start_page_key, full_phrase, and line_ids are required for each citation.\n\u2022 Infer line_ids, as we only provide the first, last, and every 5th line. When copying a previous <cite />, use the full info from the previous citation without changing the start_page_key, line_ids, or any other <cite /> attributes.\n\u2022 Use refer to line_ids inclusively, and use a range (or single) for each citation, split multiple sequential line_ids into multiple citations.\n\u2022 These citations will be replaced and displayed in-line as a numeric element (e.g. [1]), the markdown preceding <cite /> should read naturally with only one <cite /> per sentence with rare exceptions for two <cite /> in a sentence. <cite /> often present best at the end of the sentence, and are not grouped at the end of the document.\n\u2022 The full_phrase should be the exact verbatim text of the phrase or paragraph from the source document to support the insight or idea.\n\u2022 We do NOT put the full_phrase inside <cite ...></cite>; we only use full_phrase inside the full_phrase attribute.\n";
1
+ export declare const CITATION_MARKDOWN_SYNTAX_PROMPT = "\nCitation syntax to use within Markdown:\n\u2022 To support any ideas or information that requires a citation from the provided content, use the following citation syntax:\n<cite file_id='file_id' start_page_key='page_number_PAGE_index_INDEX' full_phrase='the verbatim text of the terse phrase inside <file_text />; remember to escape quotes and newlines inside the full_phrase to remain as valid JSON' key_span='the verbatim value or 1-3 words within full_phrase that best support the citation' line_ids='2-6' reasoning='the terse logic used to conclude the citation' />\n\n\u2022 Very important: for page numbers, only use the page number and page index info from the page_number_PAGE_index_INDEX format (e.g. <page_number_1_index_0>) and never from the contents inside the page.\n\u2022 start_page_key, full_phrase, and line_ids are required for each citation.\n\u2022 Infer line_ids, as we only provide the first, last, and every 5th line. When copying a previous <cite />, use the full info from the previous citation without changing the start_page_key, line_ids, or any other <cite /> attributes.\n\u2022 Use refer to line_ids inclusively, and use a range (or single) for each citation, split multiple sequential line_ids into multiple citations.\n\u2022 These citations will be replaced and displayed in-line as a numeric element (e.g. [1]), the markdown preceding <cite /> should read naturally with only one <cite /> per sentence with rare exceptions for two <cite /> in a sentence. <cite /> often present best at the end of the sentence, and are not grouped at the end of the document.\n\u2022 The full_phrase should be the exact verbatim text of the phrase or paragraph from the source document to support the insight or idea.\n\u2022 We do NOT put the full_phrase inside <cite ...></cite>; we only use full_phrase inside the full_phrase attribute.\n";
2
2
  export declare const AV_CITATION_MARKDOWN_SYNTAX_PROMPT = "\n\u2022 To support any ideas or information that requires a citation from the provided content, use the following citation syntax:\n<cite file_id='file_id' full_phrase='the verbatim text of the phrase; remember to escape quotes and newlines inside the full_phrase to remain as valid JSON' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' reasoning='the logic connecting the form section requirements to the supporting source citation' />\n\u2022 These citations are displayed in-line or in the relevant list item, and are not grouped at the end of the document.\n";
3
3
  export interface WrapSystemPromptOptions {
4
4
  /** The original system prompt to wrap with citation instructions */
@@ -1,7 +1,7 @@
1
1
  export const CITATION_MARKDOWN_SYNTAX_PROMPT = `
2
2
  Citation syntax to use within Markdown:
3
3
  • To support any ideas or information that requires a citation from the provided content, use the following citation syntax:
4
- <cite file_id='file_id' start_page_key='page_number_PAGE_index_INDEX' full_phrase='the verbatim text of the terse phrase inside <file_text />; remember to escape quotes and newlines inside the full_phrase to remain as valid JSON' key_span='the verbatim value or words within full_phrase that best support the citation' line_ids='2-6' reasoning='the terse logic used to conclude the citation' />
4
+ <cite file_id='file_id' start_page_key='page_number_PAGE_index_INDEX' full_phrase='the verbatim text of the terse phrase inside <file_text />; remember to escape quotes and newlines inside the full_phrase to remain as valid JSON' key_span='the verbatim value or 1-3 words within full_phrase that best support the citation' line_ids='2-6' reasoning='the terse logic used to conclude the citation' />
5
5
 
6
6
  • Very important: for page numbers, only use the page number and page index info from the page_number_PAGE_index_INDEX format (e.g. <page_number_1_index_0>) and never from the contents inside the page.
7
7
  • start_page_key, full_phrase, and line_ids are required for each citation.
@@ -125,7 +125,7 @@ export const CITATION_JSON_OUTPUT_FORMAT = {
125
125
  },
126
126
  keySpan: {
127
127
  type: "string",
128
- description: "the verbatim value or words within fullPhrase that best support the citation",
128
+ description: "the verbatim value or 1-3 words within fullPhrase that best support the citation",
129
129
  },
130
130
  lineIds: {
131
131
  type: "array",
@@ -1,3 +1,3 @@
1
- export * from "./promptCompression";
2
- export * from "./citationPrompts";
3
- export * from "./types";
1
+ export * from "./promptCompression.js";
2
+ export * from "./citationPrompts.js";
3
+ export * from "./types.js";
@@ -1,3 +1,3 @@
1
- export * from "./promptCompression";
2
- export * from "./citationPrompts";
3
- export * from "./types";
1
+ export * from "./promptCompression.js";
2
+ export * from "./citationPrompts.js";
3
+ export * from "./types.js";
@@ -1,4 +1,4 @@
1
- import { CompressedResult } from "./types";
1
+ import { CompressedResult } from "./types.js";
2
2
  /**
3
3
  * Compress all occurrences of `ids` inside `obj`, returning a new object
4
4
  * plus the `prefixMap` needed to decompress.
@@ -1,5 +1,5 @@
1
- import { type ScreenBox } from "./boxes";
2
- import { type FoundHighlightLocation } from "./foundHighlight";
1
+ import { type ScreenBox } from "./boxes.js";
2
+ import { type FoundHighlightLocation } from "./foundHighlight.js";
3
3
  export type OutputImageFormat = "jpeg" | "png" | "avif" | undefined | null;
4
4
  export declare const DEFAULT_OUTPUT_IMAGE_FORMAT: "avif";
5
5
  export interface VerifyCitationResponse {
@@ -1,6 +1,6 @@
1
- import { type Citation } from "./citation";
2
- import { type SearchState } from "./search";
3
- import { type PdfSpaceItem } from "./boxes";
1
+ import { type Citation } from "./citation.js";
2
+ import { type SearchState } from "./search.js";
3
+ import { type PdfSpaceItem } from "./boxes.js";
4
4
  export declare const NOT_FOUND_HIGHLIGHT_INDEX = -1;
5
5
  export declare const PENDING_HIGHLIGHT_INDEX = -2;
6
6
  export declare const BLANK_HIGHLIGHT_LOCATION: FoundHighlightLocation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepcitation/deepcitation-js",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "DeepCitation JavaScript SDK for deterministic AI citation verification",
5
5
  "type": "module",
6
6
  "private": false,