mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(Mistral AI Node): New node (#16631)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import { encodeBinaryData, processResponseData } from '../GenericFunctions';
|
||||
|
||||
describe('Mistral OCR Generic Functions', () => {
|
||||
describe('encodeBinaryData', () => {
|
||||
const binaryBuffer = Buffer.from('testdata');
|
||||
const base64 = binaryBuffer.toString('base64');
|
||||
|
||||
const context = {
|
||||
getNodeParameter: jest.fn(),
|
||||
helpers: {
|
||||
assertBinaryData: jest.fn(),
|
||||
getBinaryDataBuffer: jest.fn(),
|
||||
},
|
||||
} as any;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should encode binary data to a data URL', async () => {
|
||||
context.getNodeParameter.mockReturnValue('binaryProp1');
|
||||
context.helpers.assertBinaryData.mockReturnValue({
|
||||
mimeType: 'image/png',
|
||||
fileName: 'file.png',
|
||||
});
|
||||
context.helpers.getBinaryDataBuffer.mockResolvedValue(binaryBuffer);
|
||||
|
||||
const result = await encodeBinaryData.call(context, 0);
|
||||
|
||||
expect(context.getNodeParameter).toHaveBeenCalledWith('binaryProperty', 0);
|
||||
expect(context.helpers.assertBinaryData).toHaveBeenCalledWith(0, 'binaryProp1');
|
||||
expect(context.helpers.getBinaryDataBuffer).toHaveBeenCalledWith(0, 'binaryProp1');
|
||||
|
||||
expect(result).toEqual({
|
||||
dataUrl: `data:image/png;base64,${base64}`,
|
||||
fileName: 'file.png',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('processResponseData', () => {
|
||||
it('should extract text and page count from pages', () => {
|
||||
const input = {
|
||||
pages: [
|
||||
{ markdown: 'Page 1 markdown', text: 'Page 1 text' },
|
||||
{ markdown: 'Page 2 markdown', text: 'Page 2 text' },
|
||||
],
|
||||
otherProp: 'test',
|
||||
};
|
||||
|
||||
const result = processResponseData(input);
|
||||
|
||||
expect(result.extractedText).toBe('Page 1 markdown\n\nPage 2 markdown');
|
||||
expect(result.pageCount).toBe(2);
|
||||
expect(result.otherProp).toBe('test');
|
||||
});
|
||||
|
||||
it('should handle empty pages array', () => {
|
||||
const input = { pages: [] };
|
||||
|
||||
const result = processResponseData(input);
|
||||
|
||||
expect(result.extractedText).toBe('');
|
||||
expect(result.pageCount).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
216
packages/nodes-base/nodes/MistralAI/test/MistralAi.node.test.ts
Normal file
216
packages/nodes-base/nodes/MistralAI/test/MistralAi.node.test.ts
Normal file
@@ -0,0 +1,216 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
import path from 'path';
|
||||
|
||||
import batchResult from './fixtures/batch.json';
|
||||
import documentResult from './fixtures/document.json';
|
||||
import imageResult from './fixtures/image.json';
|
||||
|
||||
describe('Mistral AI Node', () => {
|
||||
const credentials = {
|
||||
mistralCloudApi: {
|
||||
apiKey: 'API-KEY',
|
||||
},
|
||||
};
|
||||
const mistralAiNock = nock('https://api.mistral.ai');
|
||||
|
||||
describe('Document -> Extract Text', () => {
|
||||
beforeAll(() => {
|
||||
// Document by URL
|
||||
mistralAiNock
|
||||
.post('/v1/ocr', {
|
||||
model: 'mistral-ocr-latest',
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_url: 'https://example.com/document.pdf',
|
||||
},
|
||||
})
|
||||
.reply(200, documentResult);
|
||||
|
||||
// Image by URL
|
||||
mistralAiNock
|
||||
.post('/v1/ocr', {
|
||||
model: 'mistral-ocr-latest',
|
||||
document: {
|
||||
type: 'image_url',
|
||||
image_url: 'https://example.com/image.jpg',
|
||||
},
|
||||
})
|
||||
.reply(200, imageResult);
|
||||
|
||||
// Document from binary
|
||||
mistralAiNock
|
||||
.post('/v1/ocr', {
|
||||
model: 'mistral-ocr-latest',
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_name: 'sample.pdf',
|
||||
document_url: 'data:application/pdf;base64,abcdefgh',
|
||||
},
|
||||
})
|
||||
.reply(200, documentResult);
|
||||
|
||||
// Image from binary
|
||||
mistralAiNock
|
||||
.post('/v1/ocr', {
|
||||
model: 'mistral-ocr-latest',
|
||||
document: {
|
||||
type: 'image_url',
|
||||
image_url: 'data:image/jpeg;base64,abcdefgh',
|
||||
},
|
||||
})
|
||||
.reply(200, imageResult);
|
||||
|
||||
// Batching
|
||||
mistralAiNock
|
||||
.post(
|
||||
'/v1/files',
|
||||
(body: string) =>
|
||||
body.includes(
|
||||
JSON.stringify({
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_name: 'sample_1.pdf',
|
||||
document_url: 'data:application/pdf;base64,abcdefgh',
|
||||
},
|
||||
}),
|
||||
) &&
|
||||
body.includes(
|
||||
JSON.stringify({
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_name: 'sample_2.pdf',
|
||||
document_url: 'data:application/pdf;base64,aaaaaaaa',
|
||||
},
|
||||
}),
|
||||
),
|
||||
)
|
||||
.reply(200, { id: 'input-file-1' });
|
||||
mistralAiNock
|
||||
.post('/v1/files', (body: string) =>
|
||||
body.includes(
|
||||
JSON.stringify({
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_name: 'sample_3.pdf',
|
||||
document_url: 'data:application/pdf;base64,aaaabbbb',
|
||||
},
|
||||
}),
|
||||
),
|
||||
)
|
||||
.reply(200, { id: 'input-file-2' });
|
||||
mistralAiNock
|
||||
.post('/v1/batch/jobs', {
|
||||
model: 'mistral-ocr-latest',
|
||||
input_files: ['input-file-1'],
|
||||
endpoint: '/v1/ocr',
|
||||
})
|
||||
.reply(200, { id: 'job-1' });
|
||||
mistralAiNock
|
||||
.post('/v1/batch/jobs', {
|
||||
model: 'mistral-ocr-latest',
|
||||
input_files: ['input-file-2'],
|
||||
endpoint: '/v1/ocr',
|
||||
})
|
||||
.reply(200, { id: 'job-2' });
|
||||
mistralAiNock.get('/v1/batch/jobs/job-1').reply(200, {
|
||||
status: 'SUCCESS',
|
||||
output_file: 'output-file-1',
|
||||
});
|
||||
mistralAiNock.get('/v1/batch/jobs/job-2').reply(200, {
|
||||
status: 'SUCCESS',
|
||||
output_file: 'output-file-2',
|
||||
});
|
||||
mistralAiNock.get('/v1/files/output-file-1/content').reply(
|
||||
200,
|
||||
batchResult
|
||||
.slice(0, 2)
|
||||
.map((item) => JSON.stringify(item))
|
||||
.join('\n'),
|
||||
);
|
||||
mistralAiNock.get('/v1/files/output-file-2/content').reply(200, batchResult[2]);
|
||||
|
||||
// Batching with delete files
|
||||
mistralAiNock
|
||||
.post(
|
||||
'/v1/files',
|
||||
(body: string) =>
|
||||
body.includes(
|
||||
JSON.stringify({
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_name: 'sample_1.pdf',
|
||||
document_url: 'data:application/pdf;base64,abcdefgh',
|
||||
},
|
||||
}),
|
||||
) &&
|
||||
body.includes(
|
||||
JSON.stringify({
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_name: 'sample_2.pdf',
|
||||
document_url: 'data:application/pdf;base64,aaaaaaaa',
|
||||
},
|
||||
}),
|
||||
),
|
||||
)
|
||||
.reply(200, { id: 'input-file-1' });
|
||||
mistralAiNock
|
||||
.post('/v1/files', (body: string) =>
|
||||
body.includes(
|
||||
JSON.stringify({
|
||||
document: {
|
||||
type: 'document_url',
|
||||
document_name: 'sample_3.pdf',
|
||||
document_url: 'data:application/pdf;base64,aaaabbbb',
|
||||
},
|
||||
}),
|
||||
),
|
||||
)
|
||||
.reply(200, { id: 'input-file-2' });
|
||||
mistralAiNock
|
||||
.post('/v1/batch/jobs', {
|
||||
model: 'mistral-ocr-latest',
|
||||
input_files: ['input-file-1'],
|
||||
endpoint: '/v1/ocr',
|
||||
})
|
||||
.reply(200, { id: 'job-1' });
|
||||
mistralAiNock
|
||||
.post('/v1/batch/jobs', {
|
||||
model: 'mistral-ocr-latest',
|
||||
input_files: ['input-file-2'],
|
||||
endpoint: '/v1/ocr',
|
||||
})
|
||||
.reply(200, { id: 'job-2' });
|
||||
mistralAiNock.get('/v1/batch/jobs/job-1').reply(200, {
|
||||
status: 'SUCCESS',
|
||||
output_file: 'output-file-1',
|
||||
});
|
||||
mistralAiNock.get('/v1/batch/jobs/job-2').reply(200, {
|
||||
status: 'SUCCESS',
|
||||
output_file: 'output-file-2',
|
||||
});
|
||||
mistralAiNock.delete('/v1/files/input-file-1').reply(200);
|
||||
mistralAiNock.delete('/v1/files/input-file-2').reply(200);
|
||||
mistralAiNock.get('/v1/files/output-file-1/content').reply(
|
||||
200,
|
||||
batchResult
|
||||
.slice(0, 2)
|
||||
.map((item) => JSON.stringify(item))
|
||||
.join('\n'),
|
||||
);
|
||||
mistralAiNock.get('/v1/files/output-file-2/content').reply(200, batchResult[2]);
|
||||
mistralAiNock.delete('/v1/files/output-file-1').reply(200);
|
||||
mistralAiNock.delete('/v1/files/output-file-2').reply(200);
|
||||
});
|
||||
|
||||
afterAll(() => mistralAiNock.done());
|
||||
|
||||
new NodeTestHarness({
|
||||
additionalPackagePaths: [path.join(__dirname, '../../../../@n8n/nodes-langchain')],
|
||||
}).setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['workflow.json'],
|
||||
});
|
||||
});
|
||||
});
|
||||
77
packages/nodes-base/nodes/MistralAI/test/fixtures/batch.json
vendored
Normal file
77
packages/nodes-base/nodes/MistralAI/test/fixtures/batch.json
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
[
|
||||
{
|
||||
"custom_id": "0",
|
||||
"response": {
|
||||
"body": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 1",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"custom_id": "1",
|
||||
"response": {
|
||||
"body": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 2",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"custom_id": "2",
|
||||
"response": {
|
||||
"body": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 3",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
20
packages/nodes-base/nodes/MistralAI/test/fixtures/document.json
vendored
Normal file
20
packages/nodes-base/nodes/MistralAI/test/fixtures/document.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
}
|
||||
}
|
||||
20
packages/nodes-base/nodes/MistralAI/test/fixtures/image.json
vendored
Normal file
20
packages/nodes-base/nodes/MistralAI/test/fixtures/image.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# EXAMPLE",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 408,
|
||||
"width": 612
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 76734
|
||||
}
|
||||
}
|
||||
582
packages/nodes-base/nodes/MistralAI/test/workflow.json
Normal file
582
packages/nodes-base/nodes/MistralAI/test/workflow.json
Normal file
@@ -0,0 +1,582 @@
|
||||
{
|
||||
"name": "Mistral AI",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-400, -380],
|
||||
"id": "48cf408c-de44-4ed2-8a43-d16a4fa5b95b",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"inputType": "url",
|
||||
"url": "https://example.com/document.pdf"
|
||||
},
|
||||
"type": "n8n-nodes-base.mistralAi",
|
||||
"typeVersion": 1,
|
||||
"position": [-180, -680],
|
||||
"id": "d7af696f-26a4-419e-9377-02c91d0ea23d",
|
||||
"name": "Document by URL",
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "l4fJwkB8bVdo6Evk",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"inputType": "url",
|
||||
"documentType": "image_url",
|
||||
"url": "https://example.com/image.jpg"
|
||||
},
|
||||
"type": "n8n-nodes-base.mistralAi",
|
||||
"typeVersion": 1,
|
||||
"position": [-180, -480],
|
||||
"id": "9bddff7e-00ab-412c-9cf3-52f88e941641",
|
||||
"name": "Image by URL",
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "l4fJwkB8bVdo6Evk",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.mistralAi",
|
||||
"typeVersion": 1,
|
||||
"position": [260, -380],
|
||||
"id": "cd64700f-abfb-48c7-b744-c68365a7cda2",
|
||||
"name": "Document from binary",
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "l4fJwkB8bVdo6Evk",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "5c5233de-3b47-4860-8598-f50059061fee",
|
||||
"name": "data",
|
||||
"value": "abcdefgh",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [-180, -280],
|
||||
"id": "ebc64cb6-524b-4ae3-8a1f-c51c33e8043b",
|
||||
"name": "Set mock data"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "toBinary",
|
||||
"sourceProperty": "data",
|
||||
"options": {
|
||||
"fileName": "sample.pdf",
|
||||
"mimeType": "application/pdf"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"typeVersion": 1.1,
|
||||
"position": [40, -380],
|
||||
"id": "9f656043-c21e-4eb8-b591-a609634e487f",
|
||||
"name": "Create PDF"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"documentType": "image_url"
|
||||
},
|
||||
"type": "n8n-nodes-base.mistralAi",
|
||||
"typeVersion": 1,
|
||||
"position": [260, -180],
|
||||
"id": "8f2cc502-c9b0-4561-9ff9-0734d336de6d",
|
||||
"name": "Image from binary",
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "l4fJwkB8bVdo6Evk",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "toBinary",
|
||||
"sourceProperty": "data",
|
||||
"options": {
|
||||
"fileName": "sample.jpg",
|
||||
"mimeType": "image/jpeg"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"typeVersion": 1.1,
|
||||
"position": [40, -180],
|
||||
"id": "e1398740-1b36-493b-8950-caf153d6fdd9",
|
||||
"name": "Create JPG"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fieldToSplitOut": "data",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"typeVersion": 1,
|
||||
"position": [40, 20],
|
||||
"id": "c6810b4b-804c-44e6-89e0-a73d585750ee",
|
||||
"name": "Split Out"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "0fc6f054-a7f0-466f-b54c-612379b9c049",
|
||||
"name": "data",
|
||||
"value": "[\"abcdefgh\", \"aaaaaaaa\", \"aaaabbbb\"]",
|
||||
"type": "array"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [-180, 20],
|
||||
"id": "887989fe-2829-43d5-86e6-333f399035b3",
|
||||
"name": "Set mock data for multiple files"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "toBinary",
|
||||
"sourceProperty": "data",
|
||||
"options": {
|
||||
"fileName": "=sample_{{ $itemIndex + 1 }}.pdf",
|
||||
"mimeType": "application/pdf"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"typeVersion": 1.1,
|
||||
"position": [260, 20],
|
||||
"id": "27ef8f5b-ee55-45f9-b66a-741cc6ccde21",
|
||||
"name": "Create PDFs"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {
|
||||
"batch": true,
|
||||
"batchSize": 2,
|
||||
"deleteFiles": false
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.mistralAi",
|
||||
"typeVersion": 1,
|
||||
"position": [480, -80],
|
||||
"id": "ad4b06b9-65e7-4b9c-b06a-bcbf0df5999a",
|
||||
"name": "Batching",
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "l4fJwkB8bVdo6Evk",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {
|
||||
"batch": true,
|
||||
"batchSize": 2
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.mistralAi",
|
||||
"typeVersion": 1,
|
||||
"position": [480, 120],
|
||||
"id": "ca14c489-02d2-459f-b694-d83112d95d13",
|
||||
"name": "Batching with delete files",
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "l4fJwkB8bVdo6Evk",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Document by URL": [
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file",
|
||||
"pageCount": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"Image by URL": [
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# EXAMPLE",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 408,
|
||||
"width": 612
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 76734
|
||||
},
|
||||
"extractedText": "# EXAMPLE",
|
||||
"pageCount": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"Document from binary": [
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file",
|
||||
"pageCount": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"Image from binary": [
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# EXAMPLE",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 408,
|
||||
"width": 612
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 76734
|
||||
},
|
||||
"extractedText": "# EXAMPLE",
|
||||
"pageCount": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"Batching": [
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 1",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file 1",
|
||||
"pageCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 2",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file 2",
|
||||
"pageCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 3",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file 3",
|
||||
"pageCount": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"Batching with delete files": [
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 1",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file 1",
|
||||
"pageCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 2",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file 2",
|
||||
"pageCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"pages": [
|
||||
{
|
||||
"index": 0,
|
||||
"markdown": "# Dummy PDF file 3",
|
||||
"images": [],
|
||||
"dimensions": {
|
||||
"dpi": 200,
|
||||
"height": 2339,
|
||||
"width": 1653
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "mistral-ocr-2505-completion",
|
||||
"document_annotation": null,
|
||||
"usage_info": {
|
||||
"pages_processed": 1,
|
||||
"doc_size_bytes": 13264
|
||||
},
|
||||
"extractedText": "# Dummy PDF file 3",
|
||||
"pageCount": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Document by URL",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Image by URL",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Set mock data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Set mock data for multiple files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set mock data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Create JPG",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Document from binary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create JPG": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Image from binary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set mock data for multiple files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split Out",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split Out": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create PDFs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create PDFs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Batching",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Batching with delete files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "2c53fedc-f105-4f02-b1e0-8e6dcf4da1fa",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "e115be144a6a5547dbfca93e774dfffa178aa94a181854c13e2ce5e14d195b2e"
|
||||
},
|
||||
"id": "N6UCbkc3HPvoTa0M",
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user