UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

91 lines (90 loc) • 2.95 kB
/** * File Processor Types * * Single source of truth for ALL file processing type definitions. * All processor infrastructure, registry, and SDK types are defined here. * * @module processors/base/types */ // ============================================================================= // CONSTANTS // ============================================================================= /** * Default retry configuration for file downloads. * Uses exponential backoff: 1s, 2s, 4s (capped at maxDelayMs) */ export const DEFAULT_RETRY_CONFIG = { maxRetries: 3, baseDelayMs: 1000, maxDelayMs: 10000, }; /** Default timeout for text file downloads (30 seconds) */ export const DEFAULT_TEXT_TIMEOUT_MS = 30000; /** Default maximum size for text files (10 MB) */ export const DEFAULT_TEXT_MAX_SIZE_MB = 10; /** Default timeout for image file downloads (30 seconds) */ export const DEFAULT_IMAGE_TIMEOUT_MS = 30000; /** Default maximum size for image files (10 MB) */ export const DEFAULT_IMAGE_MAX_SIZE_MB = 10; // ============================================================================= // PRIORITY CONSTANTS // ============================================================================= /** * Priority levels for file processors. * Lower number = higher priority = matched first. * * This priority system ensures that: * - SVG files are processed as text (not images) since many AI providers don't support SVG format * - More specific processors match before generic ones * - Document types are processed in a logical order */ export const PROCESSOR_PRIORITIES = { /** SVG files - processed as text before image processing */ SVG: 5, /** Image files - AI vision processing */ IMAGE: 10, /** PDF documents */ PDF: 20, /** CSV/tabular data */ CSV: 30, /** Markdown files - structured text */ MARKDOWN: 40, /** JSON data files */ JSON: 50, /** YAML configuration/data files */ YAML: 60, /** XML data files */ XML: 70, /** HTML web content */ HTML: 80, /** Excel spreadsheets */ EXCEL: 90, /** Legacy .doc files */ DOC: 95, /** Word documents (.docx) */ WORD: 100, /** Plain text files */ TEXT: 110, /** Source code files */ SOURCE_CODE: 120, /** Configuration files */ CONFIG: 130, /** RTF documents */ RTF: 140, /** OpenDocument format files */ OPENDOCUMENT: 150, /** Video files */ VIDEO: 160, /** Audio files */ AUDIO: 170, /** Archive files */ ARCHIVE: 180, }; // ============================================================================= // ERROR MESSAGE TEMPLATE // ============================================================================= /** * Error message template with user-friendly messaging and retry information. * Re-exported from errors module for convenience. */ export { FileErrorCode } from "../processors/errors/FileErrorCode.js";