n8n-nodes-vlm 3.3.3 → 3.3.5

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.
@@ -325,6 +325,7 @@ class VLMComplexityWorkflow {
325
325
  serverUrl,
326
326
  base64Image,
327
327
  timeout,
328
+ model, // Pass selected model to API
328
329
  });
329
330
  this.logger.debug(`VLM CLASSIFICATION [${i}]: ${classification.complexity} (confidence: ${classification.confidence}, model: ${classification.modelUsed})`);
330
331
  // Determine base64 output value based on format preference
@@ -8,11 +8,6 @@ export interface VLMConfig {
8
8
  classificationStrategy?: 'metadata' | 'filter' | 'both';
9
9
  filterComplexity?: 'LOW' | 'HIGH' | 'both';
10
10
  }
11
- export interface SingleDocConfig {
12
- serverUrl: string;
13
- base64Image?: string;
14
- timeout: number;
15
- }
16
11
  export interface VLClassificationResult {
17
12
  complexity: 'LOW' | 'HIGH';
18
13
  confidence?: number;
@@ -31,6 +26,12 @@ export interface ServerStatus {
31
26
  * Check server status to detect VLM classifier capabilities
32
27
  */
33
28
  export declare function checkServerStatus(context: VLMContext, serverUrl: string, timeout?: number): Promise<ServerStatus>;
29
+ export interface SingleDocConfig {
30
+ serverUrl: string;
31
+ base64Image?: string;
32
+ timeout: number;
33
+ model?: string;
34
+ }
34
35
  /**
35
36
  * Classify a single document - simplified API for workflow node v3
36
37
  * Always returns a result (defaults to LOW on error)
@@ -40,29 +40,31 @@ async function checkServerStatus(context, serverUrl, timeout = 5000) {
40
40
  /**
41
41
  * Classify a single document's complexity using VLM Classifier API
42
42
  */
43
- async function classifyDocumentComplexity(context, serverUrl, document, timeout) {
43
+ async function classifyDocumentComplexity(context, serverUrl, document, timeout, model) {
44
44
  var _a, _b, _c, _d, _e, _f, _g;
45
45
  try {
46
46
  // Prepare document content for classification
47
47
  const content = document.pageContent || JSON.stringify(document);
48
48
  // Check if document contains image data
49
49
  const hasImage = document.image || document.base64Image;
50
- // For /api/classify/base64 endpoint, only send image field
50
+ // For /api/classify/base64 endpoint, send image and model
51
51
  let requestBody;
52
52
  if (hasImage) {
53
53
  requestBody = {
54
- image: document.base64Image || document.image
54
+ image: document.base64Image || document.image,
55
+ model: model || 'vl-classifier', // Pass selected model to API
55
56
  };
56
- (_a = context.logger) === null || _a === void 0 ? void 0 : _a.debug(`VLM Classification: Sending request with image (${requestBody.image.substring(0, 50)}...)`);
57
+ (_a = context.logger) === null || _a === void 0 ? void 0 : _a.debug(`VLM Classification: Sending request with image and model=${model} (${requestBody.image.substring(0, 50)}...)`);
57
58
  }
58
59
  else {
59
60
  // Fallback: send text if no image available
60
61
  requestBody = {
61
62
  text: content,
63
+ model: model || 'vl-classifier',
62
64
  };
63
- (_b = context.logger) === null || _b === void 0 ? void 0 : _b.debug('VLM Classification: Sending request without image (text only)');
65
+ (_b = context.logger) === null || _b === void 0 ? void 0 : _b.debug(`VLM Classification: Sending request without image (text only, model=${model})`);
64
66
  }
65
- (_c = context.logger) === null || _c === void 0 ? void 0 : _c.debug(`VLM Classification: Calling ${serverUrl}/api/classify/base64`);
67
+ (_c = context.logger) === null || _c === void 0 ? void 0 : _c.debug(`VLM Classification: Calling ${serverUrl}/api/classify/base64 with model=${model}`);
66
68
  const response = await context.helpers.httpRequest({
67
69
  method: 'POST',
68
70
  url: `${serverUrl}/api/classify/base64`,
@@ -79,7 +81,7 @@ async function classifyDocumentComplexity(context, serverUrl, document, timeout)
79
81
  complexity: response.class_name || response.complexity || response.classification || 'LOW',
80
82
  confidence: response.confidence,
81
83
  processingTime: response.processing_time || response.processingTime || response.latency_ms,
82
- modelUsed: response.model || 'VLM-Classifier',
84
+ modelUsed: response.model || model || 'VLM-Classifier',
83
85
  };
84
86
  }
85
87
  catch (error) {
@@ -103,12 +105,12 @@ async function classifyDocumentComplexity(context, serverUrl, document, timeout)
103
105
  */
104
106
  async function classifySingleDocument(context, config) {
105
107
  var _a, _b, _c;
106
- const { serverUrl, base64Image, timeout } = config;
108
+ const { serverUrl, base64Image, timeout, model } = config;
107
109
  try {
108
110
  const requestBody = base64Image
109
- ? { image: base64Image }
110
- : { text: '' };
111
- (_a = context.logger) === null || _a === void 0 ? void 0 : _a.debug(`VLM Single Classification: Calling ${serverUrl}/api/classify/base64 (hasImage: ${!!base64Image})`);
111
+ ? { image: base64Image, model: model || 'vl-classifier' }
112
+ : { text: '', model: model || 'vl-classifier' };
113
+ (_a = context.logger) === null || _a === void 0 ? void 0 : _a.debug(`VLM Single Classification: Calling ${serverUrl}/api/classify/base64 (hasImage: ${!!base64Image}, model: ${model})`);
112
114
  const response = await context.helpers.httpRequest({
113
115
  method: 'POST',
114
116
  url: `${serverUrl}/api/classify/base64`,
@@ -125,7 +127,7 @@ async function classifySingleDocument(context, config) {
125
127
  complexity: response.class_name || response.complexity || response.classification || 'LOW',
126
128
  confidence: response.confidence,
127
129
  processingTime: response.processing_time || response.processingTime || response.latency_ms,
128
- modelUsed: response.model || 'VLM-Classifier',
130
+ modelUsed: response.model || model || 'VLM-Classifier',
129
131
  };
130
132
  }
131
133
  catch (error) {
@@ -142,10 +144,10 @@ async function classifySingleDocument(context, config) {
142
144
  * Classify documents using VLM Classifier
143
145
  */
144
146
  async function classifyDocuments(context, config) {
145
- const { serverUrl, documents, timeout, classificationStrategy = 'metadata', filterComplexity = 'both' } = config;
147
+ const { serverUrl, model, documents, timeout, classificationStrategy = 'metadata', filterComplexity = 'both' } = config;
146
148
  // Step 1: Classify all documents
147
149
  const classificationPromises = documents.map(async (doc, index) => {
148
- const classification = await classifyDocumentComplexity(context, serverUrl, doc, timeout);
150
+ const classification = await classifyDocumentComplexity(context, serverUrl, doc, timeout, model);
149
151
  return { doc, index, classification };
150
152
  });
151
153
  const classifiedDocs = await Promise.all(classificationPromises);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-vlm",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "description": "Vision-Language Models for n8n - Lightweight specialized VLMs for document analysis and classification",
5
5
  "main": "dist/index.js",
6
6
  "author": "Nicolas Geysse",
@@ -82,5 +82,9 @@
82
82
  "engines": {
83
83
  "node": ">=18.0.0",
84
84
  "npm": ">=9.0.0"
85
+ },
86
+ "overrides": {
87
+ "form-data": "^4.0.4",
88
+ "lodash": "^4.17.23"
85
89
  }
86
90
  }