[Platform][Mistral] Add OCR support via the /v1/ocr endpoint#2161
Merged
Conversation
chr-hertel
reviewed
Jun 12, 2026
chr-hertel
requested changes
Jun 12, 2026
chr-hertel
left a comment
Member
There was a problem hiding this comment.
Thanks for working on this @tacman - including that in the demo is great, but UI needs some love there: gap between the rows and no bg color/gradient (also for detail page) is inconsistent
Thanks already!
Contributor
Author
|
Yes. I'll tweak the UI and make getting the OCR layout a #[AsTool] -- then the agent can fetch the layout and respond. |
chr-hertel
reviewed
Jun 19, 2026
Member
Member
|
Thank you @tacman. |
chr-hertel
approved these changes
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds OCR support to the Mistral bridge via the dedicated
/v1/ocrendpoint, asdiscussed in #2072.
Mistral's
mistral-ocr-latestmodel is not a chat completion — it uses aseparate endpoint and returns structured per-page output, so it can't be routed
through
MessageBag/chat. Following the existing Whisper bridge pattern, thisadds a dedicated
Ocrmodel with its ownModelClientandResultConverter:The result is a typed
OcrResult(pages with markdown, layout images + boundingboxes, per-page annotations, usage info) via
ObjectResult/asObject(), not atext blob. Document URL, binary PDF and image inputs all work — the existing
Document,DocumentUrlandImageUrlcontract normalizers were widened toalso accept the
Ocrmodel. Catalog entries (mistral-ocr-latest,mistral-ocr-2505) plus a generator rule keep OCR models out of the chat class.Verified end-to-end against the live API (a 29-page arXiv PDF by URL and a
binary PDF by base64), plus unit tests for the client, converter and catalog.
Also includes a
Document OCRdemo (demo/) showing the feature as a chat thatextracts a document's text and answers questions about it.
Docs:
docs/components/platform.rst, the bridgeREADME.md, examples underexamples/mistral/, and aCHANGELOG.mdentry.Companion PR #2160 (
CacheableInputInterface) makes theai.platform.cache.*decorator able to cache content-object inputs like
DocumentUrl, so OCR resultscan be cached at the platform layer — independent of this PR.