Skip to content

Commit ab137da

Browse files
committed
fix(mistral): say V3 parses an uploaded or referenced PDF, and bound Max Images at 100
1 parent 1b1639c commit ab137da

7 files changed

Lines changed: 18 additions & 10 deletions

File tree

‎apps/docs/content/docs/integrations/mistral_parse.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Use [Mistral's OCR API](https://mistral.ai/) to extract text and page structure
1515

1616
## Use the block [#usage-instructions]
1717

18-
Extract text, tables, and images from uploaded PDF documents, or from a URL. Images come back as files an agent can pass on.
18+
Extract text, tables, and images from an uploaded PDF or a file from a previous block. Images come back as files an agent can pass on.
1919

2020
## Actions
2121

‎apps/sim/blocks/blocks/mistral_parse.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
normalizeFileInput,
1313
parseOptionalNumberInput,
1414
} from '@/blocks/utils'
15+
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'
1516

1617
export const MistralParseBlock: BlockConfig = {
1718
type: 'mistral_parse',
@@ -310,7 +311,7 @@ export const MistralParseV3Block: BlockConfig = {
310311
name: 'Mistral Parser',
311312
description: 'Extract text, tables, and images from PDF documents',
312313
longDescription:
313-
'Extract text, tables, and images from uploaded PDF documents, or from a URL. Images come back as files an agent can pass on.',
314+
'Extract text, tables, and images from an uploaded PDF or a file from a previous block. Images come back as files an agent can pass on.',
314315
hideFromToolbar: false,
315316
/* v3 renamed the canonical pair's advanced member `filePath` -> `fileReference`,
316317
so the inherited sentence would reference a subblock this block lacks. */
@@ -464,6 +465,7 @@ export const MistralParseV3Block: BlockConfig = {
464465
parameters.imageLimit = parseOptionalNumberInput(params.imageLimit, 'Max Images', {
465466
integer: true,
466467
min: 0,
468+
max: MAX_OCR_EXTRACTED_IMAGES,
467469
})
468470
parameters.imageMinSize = parseOptionalNumberInput(
469471
params.imageMinSize,

‎apps/sim/lib/internal/mistral/images.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, it } from 'vitest'
2-
import { extractOcrImageFiles, MAX_OCR_EXTRACTED_IMAGES } from '@/lib/internal/mistral/images'
2+
import { extractOcrImageFiles } from '@/lib/internal/mistral/images'
3+
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'
34

45
const JPEG = Buffer.concat([Buffer.from([0xff, 0xd8, 0xff]), Buffer.from('synthetic jpeg body')])
56
const dataUri = (bytes: Buffer) => `data:image/jpeg;base64,${bytes.toString('base64')}`

‎apps/sim/lib/internal/mistral/images.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import type { InternalToolFile } from '@/lib/internal/tool-operations/file-resul
55
import { MAX_BUFFERED_TRANSFER_BYTES } from '@/lib/uploads/shared/types'
66
import { resolveEffectiveMimeType } from '@/lib/uploads/utils/file'
77
import { resolveStoredFileMetadata } from '@/lib/uploads/utils/stored-file-metadata'
8-
9-
/** Most images one parse stores; Mistral's `image_limit` is clamped to it. */
10-
export const MAX_OCR_EXTRACTED_IMAGES = 100
8+
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'
119

1210
/** Largest single image kept; a bigger one is a page scan, not a figure. */
1311
const MAX_OCR_IMAGE_BYTES = 20 * 1024 * 1024

‎apps/sim/lib/internal/mistral/operations.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { decodeDataUriWithinLimit } from '@/lib/file-parsers/data-uri'
77
import { isFileParserError } from '@/lib/file-parsers/errors'
88
import { submitMistralOcr } from '@/lib/internal/mistral/client'
99
import { MistralOperationError } from '@/lib/internal/mistral/errors'
10-
import { extractOcrImageFiles, MAX_OCR_EXTRACTED_IMAGES } from '@/lib/internal/mistral/images'
10+
import { extractOcrImageFiles } from '@/lib/internal/mistral/images'
1111
import type { MistralParseInput } from '@/lib/internal/mistral/input'
1212
import { countMistralPdfPages } from '@/lib/internal/mistral/page-count'
1313
import {
@@ -31,6 +31,7 @@ import {
3131
type ServableFile,
3232
} from '@/lib/uploads/utils/file.server'
3333
import { assertToolFileAccess } from '@/app/api/files/authorization'
34+
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'
3435

3536
const logger = createLogger('MistralOperations')
3637
const IMAGE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.avif'] as const

‎apps/sim/tools/mistral/types.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import type { RawFileInput } from '@/lib/uploads/utils/file'
22
import type { UserFile } from '@/executor/types'
33
import type { OutputProperty, ToolResponse } from '@/tools/types'
44

5+
/**
6+
* Most images one Mistral Parser run extracts. Bounds the block's Max Images field, the
7+
* server's `image_limit` clamp, and the extraction loop.
8+
*/
9+
export const MAX_OCR_EXTRACTED_IMAGES = 100
10+
511
/**
612
* Shared output property definitions for Mistral OCR API responses.
713
* Based on Mistral API documentation: https://docs.mistral.ai/api/endpoint/ocr

‎packages/deployment-config/src/integrations.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"updatedAt": "2026-11-10",
2+
"updatedAt": "2026-11-11",
33
"integrations": [
44
{
55
"type": "onepassword",
@@ -18362,7 +18362,7 @@
1836218362
"slug": "mistral-parser",
1836318363
"name": "Mistral Parser",
1836418364
"description": "Extract text, tables, and images from PDF documents",
18365-
"longDescription": "Extract text, tables, and images from uploaded PDF documents, or from a URL. Images come back as files an agent can pass on.",
18365+
"longDescription": "Extract text, tables, and images from an uploaded PDF or a file from a previous block. Images come back as files an agent can pass on.",
1836618366
"bgColor": "#000000",
1836718367
"iconName": "MistralIcon",
1836818368
"docsUrl": "https://docs.sim.ai/integrations/mistral_parse",
@@ -18379,7 +18379,7 @@
1837918379
"category": "tools",
1838018380
"integrationType": "ai",
1838118381
"tags": ["document-processing", "ocr"],
18382-
"updatedAt": "2026-11-10"
18382+
"updatedAt": "2026-11-11"
1838318383
},
1838418384
{
1838518385
"type": "modal",

0 commit comments

Comments
 (0)