@juspay/neurolink 8.7.0 → 8.9.0
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 +12 -0
- package/dist/lib/types/fileTypes.d.ts +56 -1
- package/dist/lib/utils/csvProcessor.d.ts +17 -0
- package/dist/lib/utils/csvProcessor.js +56 -4
- package/dist/types/fileTypes.d.ts +56 -1
- package/dist/utils/csvProcessor.d.ts +17 -0
- package/dist/utils/csvProcessor.js +56 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [8.9.0](https://github.com/juspay/neurolink/compare/v8.8.0...v8.9.0) (2025-12-11)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- **(csv):** add sampleDataFormat option for CSV metadata ([ded6ec4](https://github.com/juspay/neurolink/commit/ded6ec4ef0924ff020de079ed3a8031490e76094))
|
|
6
|
+
|
|
7
|
+
## [8.8.0](https://github.com/juspay/neurolink/compare/v8.7.0...v8.8.0) (2025-12-11)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- **(types):** add AudioProviderConfig type definition for transcription providers ([c34f437](https://github.com/juspay/neurolink/commit/c34f437455fba20b803b84811b9dda143351427e))
|
|
12
|
+
|
|
1
13
|
## [8.7.0](https://github.com/juspay/neurolink/compare/v8.6.0...v8.7.0) (2025-12-10)
|
|
2
14
|
|
|
3
15
|
### Features
|
|
@@ -41,7 +41,7 @@ export type FileProcessingResult = {
|
|
|
41
41
|
rowCount?: number;
|
|
42
42
|
columnCount?: number;
|
|
43
43
|
columnNames?: string[];
|
|
44
|
-
sampleData?: string;
|
|
44
|
+
sampleData?: string | unknown[];
|
|
45
45
|
hasEmptyColumns?: boolean;
|
|
46
46
|
version?: string;
|
|
47
47
|
estimatedPages?: number | null;
|
|
@@ -49,6 +49,14 @@ export type FileProcessingResult = {
|
|
|
49
49
|
apiType?: PDFAPIType;
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Sample data format options for CSV metadata
|
|
54
|
+
* - 'json': JSON string representation (default, backward compatible)
|
|
55
|
+
* - 'object': Structured array of row objects (best for programmatic use)
|
|
56
|
+
* - 'csv': CSV formatted string preview
|
|
57
|
+
* - 'markdown': Markdown table format
|
|
58
|
+
*/
|
|
59
|
+
export type SampleDataFormat = "object" | "json" | "csv" | "markdown";
|
|
52
60
|
/**
|
|
53
61
|
* CSV processor options
|
|
54
62
|
*/
|
|
@@ -56,6 +64,7 @@ export type CSVProcessorOptions = {
|
|
|
56
64
|
maxRows?: number;
|
|
57
65
|
formatStyle?: "raw" | "markdown" | "json";
|
|
58
66
|
includeHeaders?: boolean;
|
|
67
|
+
sampleDataFormat?: SampleDataFormat;
|
|
59
68
|
};
|
|
60
69
|
/**
|
|
61
70
|
* PDF API types for different providers
|
|
@@ -80,6 +89,52 @@ export type PDFProcessorOptions = {
|
|
|
80
89
|
maxSizeMB?: number;
|
|
81
90
|
bedrockApiMode?: "converse" | "invokeModel";
|
|
82
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Audio provider configuration for transcription services
|
|
94
|
+
*
|
|
95
|
+
* Describes the capabilities and limitations of each audio transcription provider
|
|
96
|
+
* (e.g., OpenAI Whisper, Google Speech-to-Text, Azure Speech Services).
|
|
97
|
+
*
|
|
98
|
+
* @example OpenAI Whisper configuration
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const openaiConfig: AudioProviderConfig = {
|
|
101
|
+
* maxSizeMB: 25,
|
|
102
|
+
* maxDurationSeconds: 600,
|
|
103
|
+
* supportedFormats: ['mp3', 'mp4', 'm4a', 'wav', 'webm'],
|
|
104
|
+
* supportsLanguageDetection: true,
|
|
105
|
+
* requiresApiKey: true,
|
|
106
|
+
* costPer60s: 0.006 // $0.006 per minute
|
|
107
|
+
* };
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example Google Speech-to-Text configuration
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const googleConfig: AudioProviderConfig = {
|
|
113
|
+
* maxSizeMB: 10,
|
|
114
|
+
* maxDurationSeconds: 480,
|
|
115
|
+
* supportedFormats: ['flac', 'wav', 'mp3', 'ogg'],
|
|
116
|
+
* supportsLanguageDetection: true,
|
|
117
|
+
* requiresApiKey: true,
|
|
118
|
+
* costPer15s: 0.004 // $0.016 per minute ($0.004 per 15 seconds)
|
|
119
|
+
* };
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export type AudioProviderConfig = {
|
|
123
|
+
/** Maximum audio file size in megabytes */
|
|
124
|
+
maxSizeMB: number;
|
|
125
|
+
/** Maximum audio duration in seconds */
|
|
126
|
+
maxDurationSeconds: number;
|
|
127
|
+
/** Supported audio formats (e.g., 'mp3', 'wav', 'm4a', 'flac', 'ogg') */
|
|
128
|
+
supportedFormats: string[];
|
|
129
|
+
/** Whether the provider supports automatic language detection */
|
|
130
|
+
supportsLanguageDetection: boolean;
|
|
131
|
+
/** Whether the provider requires an API key for authentication */
|
|
132
|
+
requiresApiKey: boolean;
|
|
133
|
+
/** Optional: Cost per 60 seconds of audio in USD */
|
|
134
|
+
costPer60s?: number;
|
|
135
|
+
/** Optional: Cost per 15 seconds of audio in USD */
|
|
136
|
+
costPer15s?: number;
|
|
137
|
+
};
|
|
83
138
|
/**
|
|
84
139
|
* Audio processor options
|
|
85
140
|
*/
|
|
@@ -65,4 +65,21 @@ export declare class CSVProcessor {
|
|
|
65
65
|
* Best for small datasets (<100 rows)
|
|
66
66
|
*/
|
|
67
67
|
private static toMarkdownTable;
|
|
68
|
+
/**
|
|
69
|
+
* Format sample data according to the specified format
|
|
70
|
+
*
|
|
71
|
+
* @param sampleRows - Array of sample row objects
|
|
72
|
+
* @param format - Output format for sample data
|
|
73
|
+
* @param includeHeaders - Whether to include headers in CSV/markdown formats
|
|
74
|
+
* @returns Formatted sample data as string or array
|
|
75
|
+
*/
|
|
76
|
+
private static formatSampleData;
|
|
77
|
+
/**
|
|
78
|
+
* Convert row objects to CSV string format
|
|
79
|
+
*
|
|
80
|
+
* @param rows - Array of row objects
|
|
81
|
+
* @param includeHeaders - Whether to include header row
|
|
82
|
+
* @returns CSV formatted string
|
|
83
|
+
*/
|
|
84
|
+
private static toCSVString;
|
|
68
85
|
}
|
|
@@ -62,7 +62,7 @@ export class CSVProcessor {
|
|
|
62
62
|
* @returns Formatted CSV data ready for LLM (JSON or Markdown)
|
|
63
63
|
*/
|
|
64
64
|
static async process(content, options) {
|
|
65
|
-
const { maxRows: rawMaxRows = 1000, formatStyle = "raw", includeHeaders = true, } = options || {};
|
|
65
|
+
const { maxRows: rawMaxRows = 1000, formatStyle = "raw", includeHeaders = true, sampleDataFormat = "json", } = options || {};
|
|
66
66
|
const maxRows = Math.max(1, Math.min(10000, rawMaxRows));
|
|
67
67
|
const csvString = content.toString("utf-8");
|
|
68
68
|
// For raw format, return original CSV with row limit (no parsing needed)
|
|
@@ -103,9 +103,7 @@ export class CSVProcessor {
|
|
|
103
103
|
const columnCount = columnNames.length;
|
|
104
104
|
const hasEmptyColumns = columnNames.some((col) => !col || col.trim() === "");
|
|
105
105
|
const sampleRows = rows.slice(0, 3);
|
|
106
|
-
const sampleData = sampleRows
|
|
107
|
-
? JSON.stringify(sampleRows, null, 2)
|
|
108
|
-
: "No data rows";
|
|
106
|
+
const sampleData = this.formatSampleData(sampleRows, sampleDataFormat, includeHeaders);
|
|
109
107
|
// Format parsed data
|
|
110
108
|
const formatted = this.formatForLLM(rows, formatStyle, includeHeaders);
|
|
111
109
|
logger.info(`[CSVProcessor] ${formatStyle} format: ${rowCount} rows × ${columnCount} columns → ${formatted.length} chars`, { rowCount, columnCount, columns: columnNames, hasEmptyColumns });
|
|
@@ -274,5 +272,59 @@ export class CSVProcessor {
|
|
|
274
272
|
});
|
|
275
273
|
return markdown;
|
|
276
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Format sample data according to the specified format
|
|
277
|
+
*
|
|
278
|
+
* @param sampleRows - Array of sample row objects
|
|
279
|
+
* @param format - Output format for sample data
|
|
280
|
+
* @param includeHeaders - Whether to include headers in CSV/markdown formats
|
|
281
|
+
* @returns Formatted sample data as string or array
|
|
282
|
+
*/
|
|
283
|
+
static formatSampleData(sampleRows, format, includeHeaders) {
|
|
284
|
+
if (sampleRows.length === 0) {
|
|
285
|
+
return format === "object" ? [] : "No data rows";
|
|
286
|
+
}
|
|
287
|
+
switch (format) {
|
|
288
|
+
case "object":
|
|
289
|
+
return sampleRows;
|
|
290
|
+
case "json":
|
|
291
|
+
return JSON.stringify(sampleRows, null, 2);
|
|
292
|
+
case "csv":
|
|
293
|
+
return this.toCSVString(sampleRows, includeHeaders);
|
|
294
|
+
case "markdown":
|
|
295
|
+
return this.toMarkdownTable(sampleRows, includeHeaders);
|
|
296
|
+
default:
|
|
297
|
+
return sampleRows;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Convert row objects to CSV string format
|
|
302
|
+
*
|
|
303
|
+
* @param rows - Array of row objects
|
|
304
|
+
* @param includeHeaders - Whether to include header row
|
|
305
|
+
* @returns CSV formatted string
|
|
306
|
+
*/
|
|
307
|
+
static toCSVString(rows, includeHeaders) {
|
|
308
|
+
if (rows.length === 0) {
|
|
309
|
+
return "";
|
|
310
|
+
}
|
|
311
|
+
const headers = Object.keys(rows[0]);
|
|
312
|
+
// Escape CSV values (wrap in quotes if contains comma, quote, or newline)
|
|
313
|
+
const escapeCSV = (value) => {
|
|
314
|
+
if (value.includes(",") || value.includes('"') || value.includes("\n")) {
|
|
315
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
316
|
+
}
|
|
317
|
+
return value;
|
|
318
|
+
};
|
|
319
|
+
const lines = [];
|
|
320
|
+
if (includeHeaders) {
|
|
321
|
+
lines.push(headers.map(escapeCSV).join(","));
|
|
322
|
+
}
|
|
323
|
+
rows.forEach((row) => {
|
|
324
|
+
const values = headers.map((h) => escapeCSV(String(row[h] ?? "")));
|
|
325
|
+
lines.push(values.join(","));
|
|
326
|
+
});
|
|
327
|
+
return lines.join("\n");
|
|
328
|
+
}
|
|
277
329
|
}
|
|
278
330
|
//# sourceMappingURL=csvProcessor.js.map
|
|
@@ -41,7 +41,7 @@ export type FileProcessingResult = {
|
|
|
41
41
|
rowCount?: number;
|
|
42
42
|
columnCount?: number;
|
|
43
43
|
columnNames?: string[];
|
|
44
|
-
sampleData?: string;
|
|
44
|
+
sampleData?: string | unknown[];
|
|
45
45
|
hasEmptyColumns?: boolean;
|
|
46
46
|
version?: string;
|
|
47
47
|
estimatedPages?: number | null;
|
|
@@ -49,6 +49,14 @@ export type FileProcessingResult = {
|
|
|
49
49
|
apiType?: PDFAPIType;
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Sample data format options for CSV metadata
|
|
54
|
+
* - 'json': JSON string representation (default, backward compatible)
|
|
55
|
+
* - 'object': Structured array of row objects (best for programmatic use)
|
|
56
|
+
* - 'csv': CSV formatted string preview
|
|
57
|
+
* - 'markdown': Markdown table format
|
|
58
|
+
*/
|
|
59
|
+
export type SampleDataFormat = "object" | "json" | "csv" | "markdown";
|
|
52
60
|
/**
|
|
53
61
|
* CSV processor options
|
|
54
62
|
*/
|
|
@@ -56,6 +64,7 @@ export type CSVProcessorOptions = {
|
|
|
56
64
|
maxRows?: number;
|
|
57
65
|
formatStyle?: "raw" | "markdown" | "json";
|
|
58
66
|
includeHeaders?: boolean;
|
|
67
|
+
sampleDataFormat?: SampleDataFormat;
|
|
59
68
|
};
|
|
60
69
|
/**
|
|
61
70
|
* PDF API types for different providers
|
|
@@ -80,6 +89,52 @@ export type PDFProcessorOptions = {
|
|
|
80
89
|
maxSizeMB?: number;
|
|
81
90
|
bedrockApiMode?: "converse" | "invokeModel";
|
|
82
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Audio provider configuration for transcription services
|
|
94
|
+
*
|
|
95
|
+
* Describes the capabilities and limitations of each audio transcription provider
|
|
96
|
+
* (e.g., OpenAI Whisper, Google Speech-to-Text, Azure Speech Services).
|
|
97
|
+
*
|
|
98
|
+
* @example OpenAI Whisper configuration
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const openaiConfig: AudioProviderConfig = {
|
|
101
|
+
* maxSizeMB: 25,
|
|
102
|
+
* maxDurationSeconds: 600,
|
|
103
|
+
* supportedFormats: ['mp3', 'mp4', 'm4a', 'wav', 'webm'],
|
|
104
|
+
* supportsLanguageDetection: true,
|
|
105
|
+
* requiresApiKey: true,
|
|
106
|
+
* costPer60s: 0.006 // $0.006 per minute
|
|
107
|
+
* };
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example Google Speech-to-Text configuration
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const googleConfig: AudioProviderConfig = {
|
|
113
|
+
* maxSizeMB: 10,
|
|
114
|
+
* maxDurationSeconds: 480,
|
|
115
|
+
* supportedFormats: ['flac', 'wav', 'mp3', 'ogg'],
|
|
116
|
+
* supportsLanguageDetection: true,
|
|
117
|
+
* requiresApiKey: true,
|
|
118
|
+
* costPer15s: 0.004 // $0.016 per minute ($0.004 per 15 seconds)
|
|
119
|
+
* };
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export type AudioProviderConfig = {
|
|
123
|
+
/** Maximum audio file size in megabytes */
|
|
124
|
+
maxSizeMB: number;
|
|
125
|
+
/** Maximum audio duration in seconds */
|
|
126
|
+
maxDurationSeconds: number;
|
|
127
|
+
/** Supported audio formats (e.g., 'mp3', 'wav', 'm4a', 'flac', 'ogg') */
|
|
128
|
+
supportedFormats: string[];
|
|
129
|
+
/** Whether the provider supports automatic language detection */
|
|
130
|
+
supportsLanguageDetection: boolean;
|
|
131
|
+
/** Whether the provider requires an API key for authentication */
|
|
132
|
+
requiresApiKey: boolean;
|
|
133
|
+
/** Optional: Cost per 60 seconds of audio in USD */
|
|
134
|
+
costPer60s?: number;
|
|
135
|
+
/** Optional: Cost per 15 seconds of audio in USD */
|
|
136
|
+
costPer15s?: number;
|
|
137
|
+
};
|
|
83
138
|
/**
|
|
84
139
|
* Audio processor options
|
|
85
140
|
*/
|
|
@@ -65,4 +65,21 @@ export declare class CSVProcessor {
|
|
|
65
65
|
* Best for small datasets (<100 rows)
|
|
66
66
|
*/
|
|
67
67
|
private static toMarkdownTable;
|
|
68
|
+
/**
|
|
69
|
+
* Format sample data according to the specified format
|
|
70
|
+
*
|
|
71
|
+
* @param sampleRows - Array of sample row objects
|
|
72
|
+
* @param format - Output format for sample data
|
|
73
|
+
* @param includeHeaders - Whether to include headers in CSV/markdown formats
|
|
74
|
+
* @returns Formatted sample data as string or array
|
|
75
|
+
*/
|
|
76
|
+
private static formatSampleData;
|
|
77
|
+
/**
|
|
78
|
+
* Convert row objects to CSV string format
|
|
79
|
+
*
|
|
80
|
+
* @param rows - Array of row objects
|
|
81
|
+
* @param includeHeaders - Whether to include header row
|
|
82
|
+
* @returns CSV formatted string
|
|
83
|
+
*/
|
|
84
|
+
private static toCSVString;
|
|
68
85
|
}
|
|
@@ -62,7 +62,7 @@ export class CSVProcessor {
|
|
|
62
62
|
* @returns Formatted CSV data ready for LLM (JSON or Markdown)
|
|
63
63
|
*/
|
|
64
64
|
static async process(content, options) {
|
|
65
|
-
const { maxRows: rawMaxRows = 1000, formatStyle = "raw", includeHeaders = true, } = options || {};
|
|
65
|
+
const { maxRows: rawMaxRows = 1000, formatStyle = "raw", includeHeaders = true, sampleDataFormat = "json", } = options || {};
|
|
66
66
|
const maxRows = Math.max(1, Math.min(10000, rawMaxRows));
|
|
67
67
|
const csvString = content.toString("utf-8");
|
|
68
68
|
// For raw format, return original CSV with row limit (no parsing needed)
|
|
@@ -103,9 +103,7 @@ export class CSVProcessor {
|
|
|
103
103
|
const columnCount = columnNames.length;
|
|
104
104
|
const hasEmptyColumns = columnNames.some((col) => !col || col.trim() === "");
|
|
105
105
|
const sampleRows = rows.slice(0, 3);
|
|
106
|
-
const sampleData = sampleRows
|
|
107
|
-
? JSON.stringify(sampleRows, null, 2)
|
|
108
|
-
: "No data rows";
|
|
106
|
+
const sampleData = this.formatSampleData(sampleRows, sampleDataFormat, includeHeaders);
|
|
109
107
|
// Format parsed data
|
|
110
108
|
const formatted = this.formatForLLM(rows, formatStyle, includeHeaders);
|
|
111
109
|
logger.info(`[CSVProcessor] ${formatStyle} format: ${rowCount} rows × ${columnCount} columns → ${formatted.length} chars`, { rowCount, columnCount, columns: columnNames, hasEmptyColumns });
|
|
@@ -274,4 +272,58 @@ export class CSVProcessor {
|
|
|
274
272
|
});
|
|
275
273
|
return markdown;
|
|
276
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Format sample data according to the specified format
|
|
277
|
+
*
|
|
278
|
+
* @param sampleRows - Array of sample row objects
|
|
279
|
+
* @param format - Output format for sample data
|
|
280
|
+
* @param includeHeaders - Whether to include headers in CSV/markdown formats
|
|
281
|
+
* @returns Formatted sample data as string or array
|
|
282
|
+
*/
|
|
283
|
+
static formatSampleData(sampleRows, format, includeHeaders) {
|
|
284
|
+
if (sampleRows.length === 0) {
|
|
285
|
+
return format === "object" ? [] : "No data rows";
|
|
286
|
+
}
|
|
287
|
+
switch (format) {
|
|
288
|
+
case "object":
|
|
289
|
+
return sampleRows;
|
|
290
|
+
case "json":
|
|
291
|
+
return JSON.stringify(sampleRows, null, 2);
|
|
292
|
+
case "csv":
|
|
293
|
+
return this.toCSVString(sampleRows, includeHeaders);
|
|
294
|
+
case "markdown":
|
|
295
|
+
return this.toMarkdownTable(sampleRows, includeHeaders);
|
|
296
|
+
default:
|
|
297
|
+
return sampleRows;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Convert row objects to CSV string format
|
|
302
|
+
*
|
|
303
|
+
* @param rows - Array of row objects
|
|
304
|
+
* @param includeHeaders - Whether to include header row
|
|
305
|
+
* @returns CSV formatted string
|
|
306
|
+
*/
|
|
307
|
+
static toCSVString(rows, includeHeaders) {
|
|
308
|
+
if (rows.length === 0) {
|
|
309
|
+
return "";
|
|
310
|
+
}
|
|
311
|
+
const headers = Object.keys(rows[0]);
|
|
312
|
+
// Escape CSV values (wrap in quotes if contains comma, quote, or newline)
|
|
313
|
+
const escapeCSV = (value) => {
|
|
314
|
+
if (value.includes(",") || value.includes('"') || value.includes("\n")) {
|
|
315
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
316
|
+
}
|
|
317
|
+
return value;
|
|
318
|
+
};
|
|
319
|
+
const lines = [];
|
|
320
|
+
if (includeHeaders) {
|
|
321
|
+
lines.push(headers.map(escapeCSV).join(","));
|
|
322
|
+
}
|
|
323
|
+
rows.forEach((row) => {
|
|
324
|
+
const values = headers.map((h) => escapeCSV(String(row[h] ?? "")));
|
|
325
|
+
lines.push(values.join(","));
|
|
326
|
+
});
|
|
327
|
+
return lines.join("\n");
|
|
328
|
+
}
|
|
277
329
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Juspay Technologies",
|