n8n-nodes-vlm 1.0.2 → 2.0.1
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.
|
@@ -33,26 +33,55 @@ class VLMComplexityClassifier {
|
|
|
33
33
|
outputNames: ['Classifier'],
|
|
34
34
|
credentials: [
|
|
35
35
|
{
|
|
36
|
-
name: '
|
|
37
|
-
required:
|
|
36
|
+
name: 'ollamaApi',
|
|
37
|
+
required: true,
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
|
+
requestDefaults: {
|
|
41
|
+
ignoreHttpStatusErrors: true,
|
|
42
|
+
baseURL: '={{ $credentials.baseUrl.replace(new RegExp("/$"), "") }}',
|
|
43
|
+
},
|
|
40
44
|
properties: [
|
|
41
|
-
{
|
|
42
|
-
displayName: 'Server URL',
|
|
43
|
-
name: 'serverUrl',
|
|
44
|
-
type: 'string',
|
|
45
|
-
default: 'http://localhost:8000',
|
|
46
|
-
placeholder: 'http://localhost:8000',
|
|
47
|
-
description: 'URL to your VLM classifier server (e.g., deposium-embeddings-turbov2)',
|
|
48
|
-
required: true,
|
|
49
|
-
},
|
|
50
45
|
{
|
|
51
46
|
displayName: 'Model',
|
|
52
47
|
name: 'model',
|
|
53
|
-
type: '
|
|
54
|
-
default: '
|
|
55
|
-
description: 'VLM model to use
|
|
48
|
+
type: 'options',
|
|
49
|
+
default: '',
|
|
50
|
+
description: 'The VLM classifier model to use - models are loaded from your configured Ollama/Custom API server',
|
|
51
|
+
typeOptions: {
|
|
52
|
+
loadOptions: {
|
|
53
|
+
routing: {
|
|
54
|
+
request: {
|
|
55
|
+
method: 'GET',
|
|
56
|
+
url: '/api/tags',
|
|
57
|
+
},
|
|
58
|
+
output: {
|
|
59
|
+
postReceive: [
|
|
60
|
+
{
|
|
61
|
+
type: 'rootProperty',
|
|
62
|
+
properties: {
|
|
63
|
+
property: 'models',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'setKeyValue',
|
|
68
|
+
properties: {
|
|
69
|
+
name: '={{$responseItem.name}}',
|
|
70
|
+
value: '={{$responseItem.name}}',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'sort',
|
|
75
|
+
properties: {
|
|
76
|
+
key: 'name',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
required: true,
|
|
56
85
|
},
|
|
57
86
|
{
|
|
58
87
|
displayName: 'Classification Strategy',
|
|
@@ -139,17 +168,22 @@ class VLMComplexityClassifier {
|
|
|
139
168
|
var _a;
|
|
140
169
|
this.logger.debug('Initializing VLM Complexity Classifier Provider');
|
|
141
170
|
const self = this;
|
|
171
|
+
// Get credentials
|
|
172
|
+
const credentials = await this.getCredentials('ollamaApi');
|
|
173
|
+
const serverUrl = credentials.baseUrl.replace(/\/$/, '');
|
|
142
174
|
// Get node parameters
|
|
143
|
-
const serverUrl = this.getNodeParameter('serverUrl', 0).replace(/\/$/, '');
|
|
144
175
|
const model = this.getNodeParameter('model', 0);
|
|
145
176
|
const classificationStrategy = this.getNodeParameter('classificationStrategy', 0);
|
|
146
177
|
const filterComplexity = this.getNodeParameter('filterComplexity', 0, 'both');
|
|
147
178
|
const additionalOptions = this.getNodeParameter('additionalOptions', 0, {});
|
|
148
179
|
const timeout = (_a = additionalOptions.timeout) !== null && _a !== void 0 ? _a : 30000;
|
|
149
|
-
// Verify server has classifier capability
|
|
180
|
+
// Verify server has classifier capability (optional check)
|
|
150
181
|
const status = await (0, vlm_logic_1.checkServerStatus)(this, serverUrl, timeout);
|
|
151
|
-
if (
|
|
152
|
-
|
|
182
|
+
if (status.status === 'error') {
|
|
183
|
+
this.logger.warn(`Could not verify server capabilities at ${serverUrl}/api/status. Proceeding anyway...`);
|
|
184
|
+
}
|
|
185
|
+
else if (!status.hasClassifier) {
|
|
186
|
+
this.logger.warn(`Server at ${serverUrl} does not explicitly report VLM classifier support. Proceeding anyway...`);
|
|
153
187
|
}
|
|
154
188
|
/**
|
|
155
189
|
* Classifier Provider Object
|
|
@@ -17,7 +17,7 @@ class VLMComplexityWorkflow {
|
|
|
17
17
|
icon: 'file:vlm.svg',
|
|
18
18
|
group: ['transform'],
|
|
19
19
|
version: 1,
|
|
20
|
-
subtitle: '={{$parameter["
|
|
20
|
+
subtitle: '={{$parameter["model"]}}',
|
|
21
21
|
description: 'Classify document complexity using Vision-Language Models',
|
|
22
22
|
defaults: {
|
|
23
23
|
name: 'VLM Complexity Workflow',
|
|
@@ -33,26 +33,55 @@ class VLMComplexityWorkflow {
|
|
|
33
33
|
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
34
34
|
credentials: [
|
|
35
35
|
{
|
|
36
|
-
name: '
|
|
37
|
-
required:
|
|
36
|
+
name: 'ollamaApi',
|
|
37
|
+
required: true,
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
|
+
requestDefaults: {
|
|
41
|
+
ignoreHttpStatusErrors: true,
|
|
42
|
+
baseURL: '={{ $credentials.baseUrl.replace(new RegExp("/$"), "") }}',
|
|
43
|
+
},
|
|
40
44
|
properties: [
|
|
41
|
-
{
|
|
42
|
-
displayName: 'Server URL',
|
|
43
|
-
name: 'serverUrl',
|
|
44
|
-
type: 'string',
|
|
45
|
-
default: 'http://localhost:8000',
|
|
46
|
-
placeholder: 'http://localhost:8000',
|
|
47
|
-
description: 'URL to your VLM classifier server (e.g., deposium-embeddings-turbov2)',
|
|
48
|
-
required: true,
|
|
49
|
-
},
|
|
50
45
|
{
|
|
51
46
|
displayName: 'Model',
|
|
52
47
|
name: 'model',
|
|
53
|
-
type: '
|
|
54
|
-
default: '
|
|
55
|
-
description: 'VLM model to use
|
|
48
|
+
type: 'options',
|
|
49
|
+
default: '',
|
|
50
|
+
description: 'The VLM classifier model to use - models are loaded from your configured Ollama/Custom API server',
|
|
51
|
+
typeOptions: {
|
|
52
|
+
loadOptions: {
|
|
53
|
+
routing: {
|
|
54
|
+
request: {
|
|
55
|
+
method: 'GET',
|
|
56
|
+
url: '/api/tags',
|
|
57
|
+
},
|
|
58
|
+
output: {
|
|
59
|
+
postReceive: [
|
|
60
|
+
{
|
|
61
|
+
type: 'rootProperty',
|
|
62
|
+
properties: {
|
|
63
|
+
property: 'models',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'setKeyValue',
|
|
68
|
+
properties: {
|
|
69
|
+
name: '={{$responseItem.name}}',
|
|
70
|
+
value: '={{$responseItem.name}}',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'sort',
|
|
75
|
+
properties: {
|
|
76
|
+
key: 'name',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
required: true,
|
|
56
85
|
},
|
|
57
86
|
{
|
|
58
87
|
displayName: 'Document Source',
|
|
@@ -211,8 +240,10 @@ class VLMComplexityWorkflow {
|
|
|
211
240
|
var _a, _b;
|
|
212
241
|
const items = this.getInputData();
|
|
213
242
|
this.logger.debug(`VLM Complexity Workflow: Processing ${items.length} input items`);
|
|
243
|
+
// Get credentials
|
|
244
|
+
const credentials = await this.getCredentials('ollamaApi');
|
|
245
|
+
const serverUrl = credentials.baseUrl.replace(/\/$/, '');
|
|
214
246
|
// Get node parameters
|
|
215
|
-
const serverUrl = this.getNodeParameter('serverUrl', 0).replace(/\/$/, '');
|
|
216
247
|
const model = this.getNodeParameter('model', 0);
|
|
217
248
|
const documentSource = this.getNodeParameter('documentSource', 0);
|
|
218
249
|
const classificationStrategy = this.getNodeParameter('classificationStrategy', 0);
|
|
@@ -220,10 +251,13 @@ class VLMComplexityWorkflow {
|
|
|
220
251
|
const additionalOptions = this.getNodeParameter('additionalOptions', 0, {});
|
|
221
252
|
const timeout = (_a = additionalOptions.timeout) !== null && _a !== void 0 ? _a : 30000;
|
|
222
253
|
const outputFormat = (_b = additionalOptions.outputFormat) !== null && _b !== void 0 ? _b : 'documents';
|
|
223
|
-
// Verify server has classifier capability
|
|
254
|
+
// Verify server has classifier capability (optional check)
|
|
224
255
|
const status = await (0, vlm_logic_1.checkServerStatus)(this, serverUrl, timeout);
|
|
225
|
-
if (
|
|
226
|
-
|
|
256
|
+
if (status.status === 'error') {
|
|
257
|
+
this.logger.warn(`Could not verify server capabilities at ${serverUrl}/api/status. Proceeding anyway...`);
|
|
258
|
+
}
|
|
259
|
+
else if (!status.hasClassifier) {
|
|
260
|
+
this.logger.warn(`Server at ${serverUrl} does not explicitly report VLM classifier support. Proceeding anyway...`);
|
|
227
261
|
}
|
|
228
262
|
// Extract documents based on source
|
|
229
263
|
let documents = [];
|
package/package.json
CHANGED