Repository navigation
Conversation
Bump every pin to its latest release within the current major line, and move the langchain family together (langchain-core 1.7.0 is required by the new langchain, langchain-openai, langchain-aws, langchain-google-genai and langchain-huggingface). boto3 rises for langchain-aws 1.9; aiofiles 25.1 unblocks current unstructured-client. tenacity stays at 9.1.4: google-genai requires <9.2. Held on purpose (breaking majors): pandas 3, SQLAlchemy 2.1, Pillow 13, chardet 7, sentence-transformers 6, mistralai 3, pgvector 0.5, asyncpg 0.32. Removed, since PDFs/images are OCR'd remotely via Mistral: - rapidocr-onnxruntime, opencv-python-headless (no imports) and the libgl1/libglib2.0-0 apt packages they needed in the full Dockerfile - networkx (no imports; only an optional langchain-mongodb extra) - pypdf from runtime deps (only a test fixture uses it; moved to test_requirements.txt, and unstructured-client still pulls it in) - mongomock (unreferenced) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mistral OCR leaves only a placeholder () for a raster image embedded in a PDF page, such as a photo or scan of a page, without reading the text inside it. The PDF request now asks for the extracted images (include_image_base64, image_min_size, image_limit); each image is OCR'd in its own call on a small thread pool, and the recognized text replaces its placeholder on the page it belongs to. A failed image call logs a warning and keeps the placeholder; the main PDF call still raises. With the feature off, the request is unchanged. New settings: MISTRAL_OCR_EMBEDDED_IMAGES (default True), MISTRAL_OCR_IMAGE_MIN_SIZE (100), MISTRAL_OCR_MAX_EMBEDDED_IMAGES (50, <=0 for no cap), MISTRAL_OCR_IMAGE_CONCURRENCY (4). Each embedded image is billed as one extra OCR page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- OCR each distinct embedded image once (sha256 of its bytes) and reuse the text, and skip images below MISTRAL_OCR_IMAGE_MIN_PAGE_FRACTION (default 0.1) of their page, so logos/letterheads repeated on every page don't cost an extra billed call each or pollute every page. - Retry OCR calls on 429/5xx and connection errors with backoff via the SDK's RetryConfig, so rate limits no longer silently drop image text. - Match placeholders on the link target with any alt text. - MISTRAL_OCR_MAX_EMBEDDED_IMAGES is now at least 1, so the response size is always bounded; request cap+1 and warn only when exceeded. - Insert text inline (newlines collapsed, `|` escaped in table rows) when the placeholder shares its line, instead of breaking tables. - Use mimetypes for data-URI mime types. - Pin MISTRAL_OCR_EMBEDDED_IMAGES=False in the older PDF tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Split the image caps: MISTRAL_OCR_MAX_EXTRACTED_IMAGES (default 200) bounds how many images Mistral extracts, while MISTRAL_OCR_MAX_EMBEDDED_IMAGES (50) now caps distinct images actually OCR'd, applied after the size filter and dedupe. Per-page logos no longer use up the cap and push real scans out. - Log each size-filtered image at DEBUG with its page fraction; keep images whose box extends beyond the page (units mismatch) and warn. - Send include_blocks=False; the SDK defaults it on and we don't use it. - A placeholder behind a block marker (#, -, >, 1.) counts as alone on its line, so a page's text no longer becomes one huge heading or item. - Bound image OCR calls in flight across all documents with a shared semaphore sized by MISTRAL_OCR_IMAGE_CONCURRENCY. - Insert the text at the first placeholder only; drop repeats. - Retry tests use a fast real RetryConfig instead of patching SDK internals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Upstream: nothing to merge;
upstream/main(LibreChat-AI/rag-api, latest 2026-09-23) is already an ancestor ofmain.1. Dependency bumps (
chore(deps))langchain-core1.7.0,langchain1.4.7,langchain-openai1.7.2,langchain-aws1.9.0,langchain-google-genai4.4.2,langchain-huggingface1.2.3,langchain-mongodb0.12.1), because all of their new versions need core ≥ 1.6.tenacitystays at 9.1.4, because google-genai requires<9.2.2. Removed dependencies the fork no longer uses
rapidocr-onnxruntime,opencv-python-headless: nothing imports them, and OCR is remote via Mistral. Also removed thelibgl1andlibglib2.0-0apt packages from the fullDockerfile, which only they needed.networkx: nothing imports it; only an optional langchain-mongodb extra lists it.pypdf: removed from the runtime deps and moved totest_requirements.txt, since only a test fixture uses it. unstructured-client still pulls it in.mongomock: nothing references it.3. OCR images embedded in PDFs (
feat(ocr))Mistral OCR returns only a placeholder (
) for a raster image embedded in a PDF page, such as a photo or scan of a page, and does not read the text inside it.include_image_base64,image_min_size,image_limit).MISTRAL_OCR_EMBEDDED_IMAGES(defaultTrue)MISTRAL_OCR_IMAGE_MIN_SIZE(100)MISTRAL_OCR_MAX_EXTRACTED_IMAGES(200, minimum 1; how many images Mistral extracts, which bounds the response size)MISTRAL_OCR_MAX_EMBEDDED_IMAGES(50, minimum 1; how many distinct images are OCR'd and billed, counted after the size filter and dedupe)MISTRAL_OCR_IMAGE_MIN_PAGE_FRACTION(0.1; smaller images such as logos are skipped)MISTRAL_OCR_IMAGE_CONCURRENCY(4; image OCR calls in flight across all documents and requests)RetryConfig.Test plan
pip checkis clean. A dry run of the fullrequirements.txtresolves.image_base64format is handled both as a data URI and as bare base64. The page-area filter assumes the bbox and page dimensions use the same pixel space.CIlabel to run it.Known, not addressed here
huggingfaceteiembeddings provider importslangchain_huggingface, which the lite image doesn't install.🤖 Generated with Claude Code