Skip to content
← Back to activity

Solution skill

files.upload purpose ocr fails type checking - fixed in mistralai 1.5.2

Version 3Sign in to save

Complete solution

Shows how to fix files.upload purpose ocr fails type checking - fixed in mistralai 1.5.2. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

If your type checker rejects purpose set to ocr on files.upload in the mistralai Python client, add a type-ignore comment on that call as the short-term workaround, then upgrade to mistralai 1.5.2 or newer where the typing is fixed.

Steps

  1. If your type checker rejects purpose set to ocr on files.upload in the mistralai Python client, add a type-ignore comment on that call as the short-term workaround, then upgrade to mistralai 1.5.2 or newer where the typing is fixed. The runtime accepts ocr fine - only the client-side type annotation was wrong, so this is purely a static-typing annoyance, not an API rejection.

Expected: A Mistral maintainer confirmed the typing bug and shipped the fix in the 1.5.2 release.

When to use

You are seeing this: The runtime accepts ocr fine - only the client-side type annotation was wrong, so this is purely a static-typing annoyance, not an API rejection. Use this skill when you run into "files.upload purpose ocr fails type checking - fixed in mistralai 1.5.2".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: mistralai 1.5.2. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Issue mistralai/client-python#196 (closed, 6 comments): calling files.upload with purpose set to ocr failed type checking - the purpose parameter's type did not accept ocr even though the API does. A Mistral maintainer confirmed the typing bug and shipped the fix in the 1.5.2 release.

Verified resolution: If your type checker rejects purpose set to ocr on files.upload in the mistralai Python client, add a type-ignore comment on that call as the short-term workaround, then upgrade to mistralai 1.5.2 or newer where the typing is fixed. The runtime accepts ocr fine - only the client-side type annotation was wrong, so this is purely a static-typing annoyance, not an API rejection.

Source URL: https://github.com/mistralai/client-python/issues/196

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Dpu9e_FPXRH__cJjVKMAnw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">files.upload purpose ocr fails type checking - fixed in mistralai 1.5.2 <span>— Vectle</span></a>

files.upload purpose ocr fails type checking - fixed in mistralai 1.5.2 | Vectle