Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/docs/content/docs/integrations/mistral_parse.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { ReferenceDetails } from "@/components/ui/reference-details"


{/* MANUAL-CONTENT-START:intro */}
Use [Mistral's OCR API](https://mistral.ai/) to extract text and page structure from a PDF uploaded to Sim or supplied by URL. The current parser returns page Markdown, image metadata, the model, and usage information. **Specific Pages** accepts zero-based indices such as `0,1,2`; leave it empty to process all pages. The block offers Markdown, plain-text, and JSON format values, but its current result uses the structured page output documented below. Turn on **Extract Images** to get the images Mistral finds in the document (figures, logos, photos) as files on the `images` output, up to 100 per parse; each page's image entry carries a `file_name` matching its file. **Max Images** and **Min Image Size** (advanced) narrow what is extracted. **Tables** keeps tables inline in the page Markdown by default, or returns them separately as Markdown or HTML in each page's `tables` list.
Use [Mistral's OCR API](https://mistral.ai/) to extract text and page structure from a PDF uploaded to Sim or passed in as a file from a previous block. The current parser returns page Markdown, image metadata, the model, and usage information. **Specific Pages** accepts zero-based indices such as `0,1,2`; leave it empty to process all pages. The block offers Markdown, plain-text, and JSON format values, but its current result uses the structured page output documented below. Turn on **Extract Images** to get the images Mistral finds in the document (figures, logos, photos) as files on the `images` output, up to 100 per parse; each page's image entry carries a `file_name` matching its file. **Max Images** and **Min Image Size** (advanced) narrow what is extracted. **Tables** keeps tables inline in the page Markdown by default, or returns them separately as Markdown or HTML in each page's `tables` list.
{/* MANUAL-CONTENT-END */}

## Use the block [#usage-instructions]

Extract text, tables, and images from uploaded PDF documents, or from a URL. Images come back as files an agent can pass on.
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.
Comment thread
waleedlatif1 marked this conversation as resolved.
Resolved

## Actions

Expand Down
4 changes: 3 additions & 1 deletion apps/sim/blocks/blocks/mistral_parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
normalizeFileInput,
parseOptionalNumberInput,
} from '@/blocks/utils'
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'

export const MistralParseBlock: BlockConfig = {
type: 'mistral_parse',
Expand Down Expand Up @@ -310,7 +311,7 @@ export const MistralParseV3Block: BlockConfig = {
name: 'Mistral Parser',
description: 'Extract text, tables, and images from PDF documents',
longDescription:
'Extract text, tables, and images from uploaded PDF documents, or from a URL. Images come back as files an agent can pass on.',
'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.',
hideFromToolbar: false,
/* v3 renamed the canonical pair's advanced member `filePath` -> `fileReference`,
so the inherited sentence would reference a subblock this block lacks. */
Expand Down Expand Up @@ -464,6 +465,7 @@ export const MistralParseV3Block: BlockConfig = {
parameters.imageLimit = parseOptionalNumberInput(params.imageLimit, 'Max Images', {
integer: true,
min: 0,
max: MAX_OCR_EXTRACTED_IMAGES,
})
parameters.imageMinSize = parseOptionalNumberInput(
params.imageMinSize,
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/lib/internal/mistral/images.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest'
import { extractOcrImageFiles, MAX_OCR_EXTRACTED_IMAGES } from '@/lib/internal/mistral/images'
import { extractOcrImageFiles } from '@/lib/internal/mistral/images'
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'

const JPEG = Buffer.concat([Buffer.from([0xff, 0xd8, 0xff]), Buffer.from('synthetic jpeg body')])
const dataUri = (bytes: Buffer) => `data:image/jpeg;base64,${bytes.toString('base64')}`
Expand Down
4 changes: 1 addition & 3 deletions apps/sim/lib/internal/mistral/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import type { InternalToolFile } from '@/lib/internal/tool-operations/file-resul
import { MAX_BUFFERED_TRANSFER_BYTES } from '@/lib/uploads/shared/types'
import { resolveEffectiveMimeType } from '@/lib/uploads/utils/file'
import { resolveStoredFileMetadata } from '@/lib/uploads/utils/stored-file-metadata'

/** Most images one parse stores; Mistral's `image_limit` is clamped to it. */
export const MAX_OCR_EXTRACTED_IMAGES = 100
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'

/** Largest single image kept; a bigger one is a page scan, not a figure. */
const MAX_OCR_IMAGE_BYTES = 20 * 1024 * 1024
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/lib/internal/mistral/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { decodeDataUriWithinLimit } from '@/lib/file-parsers/data-uri'
import { isFileParserError } from '@/lib/file-parsers/errors'
import { submitMistralOcr } from '@/lib/internal/mistral/client'
import { MistralOperationError } from '@/lib/internal/mistral/errors'
import { extractOcrImageFiles, MAX_OCR_EXTRACTED_IMAGES } from '@/lib/internal/mistral/images'
import { extractOcrImageFiles } from '@/lib/internal/mistral/images'
import type { MistralParseInput } from '@/lib/internal/mistral/input'
import { countMistralPdfPages } from '@/lib/internal/mistral/page-count'
import {
Expand All @@ -31,6 +31,7 @@ import {
type ServableFile,
} from '@/lib/uploads/utils/file.server'
import { assertToolFileAccess } from '@/app/api/files/authorization'
import { MAX_OCR_EXTRACTED_IMAGES } from '@/tools/mistral/types'

const logger = createLogger('MistralOperations')
const IMAGE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.avif'] as const
Expand Down
6 changes: 6 additions & 0 deletions apps/sim/tools/mistral/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import type { RawFileInput } from '@/lib/uploads/utils/file'
import type { UserFile } from '@/executor/types'
import type { OutputProperty, ToolResponse } from '@/tools/types'

/**
* Most images one Mistral Parser run extracts. Bounds the block's Max Images field, the
* server's `image_limit` clamp, and the extraction loop.
*/
export const MAX_OCR_EXTRACTED_IMAGES = 100

/**
* Shared output property definitions for Mistral OCR API responses.
* Based on Mistral API documentation: https://docs.mistral.ai/api/endpoint/ocr
Expand Down
6 changes: 3 additions & 3 deletions packages/deployment-config/src/integrations.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"updatedAt": "2026-11-10",
"updatedAt": "2026-11-11",
"integrations": [
{
"type": "onepassword",
Expand Down Expand Up @@ -18362,7 +18362,7 @@
"slug": "mistral-parser",
"name": "Mistral Parser",
"description": "Extract text, tables, and images from PDF documents",
"longDescription": "Extract text, tables, and images from uploaded PDF documents, or from a URL. Images come back as files an agent can pass on.",
"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.",
"bgColor": "#000000",
"iconName": "MistralIcon",
"docsUrl": "https://docs.sim.ai/integrations/mistral_parse",
Expand All @@ -18379,7 +18379,7 @@
"category": "tools",
"integrationType": "ai",
"tags": ["document-processing", "ocr"],
"updatedAt": "2026-11-10"
"updatedAt": "2026-11-11"
},
{
"type": "modal",
Expand Down
Loading