Skip to content

improvement(providers): tighten Gemini and vLLM agent-attachment ceilings#5095

Merged
waleedlatif1 merged 1 commit into
stagingfrom
improvement/provider-attachment-limits
Jun 16, 2026
Merged

improvement(providers): tighten Gemini and vLLM agent-attachment ceilings#5095
waleedlatif1 merged 1 commit into
stagingfrom
improvement/provider-attachment-limits

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to the provider large-file attachment feature (#5092). A live-doc audit of each provider surfaced two ceilings set higher than the provider actually accepts:

  • Gemini: 100MB → 50MB. Gemini hard-caps PDFs at 50MB. A 50–100MB PDF previously passed our gate, got buffered + uploaded to the File API + polled to ACTIVE, then failed at generateContent — wasted work and a confusing late error. 50MB respects the documented limit and is more memory-safe.
  • vLLM: 50MB → 25MB. vLLM's default VLLM_IMAGE_FETCH_TIMEOUT is 5s; a 50MB remote-URL fetch routinely exceeds it. 25MB aligns with that reality and matches Baseten (the other vLLM-backed provider).

Every other provider's strategy and limit was validated as correct against live docs in the same audit; these were the only two worth tightening. The /models provider pages read these values dynamically, so they update automatically.

Type of Change

  • Improvement

Testing

  • NODE_OPTIONS='--max-old-space-size=8192' bunx tsc --noEmit clean
  • providers/attachments.test.ts + providers/vllm/index.test.ts pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…ings

A live-doc audit of the merged large-file feature found two ceilings that were
higher than the provider actually accepts:
- Gemini: 100MB -> 50MB. Gemini hard-caps PDFs at 50MB, so a 50-100MB PDF passed
  our gate, got uploaded + polled, then failed at generateContent. 50MB respects
  the documented limit and is more memory-safe.
- vLLM: 50MB -> 25MB. vLLM's default image-fetch timeout is 5s; a 50MB remote
  fetch routinely exceeds it. 25MB aligns with that reality and matches Baseten
  (the other vLLM-backed provider).
@cursor

cursor Bot commented Jun 16, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Two numeric limits in the provider registry; no attachment pipeline or strategy changes, with tests noted as updated in the PR description.

Overview
Lowers agent-block file attachment maxBytes in PROVIDER_DEFINITIONS for two providers so pre-upload validation matches what the backends actually accept.

Google (Gemini) drops from 100MB to 50MB (files-api strategy unchanged). Oversized PDFs were passing the app gate, then failing late at generateContent after File API upload work.

vLLM drops from 50MB to 25MB (remote-url unchanged), aligning with typical fetch timeouts and Baseten’s ceiling. Anything that reads limits via getProviderFileAttachment—including /models provider pages—picks up the new caps automatically.

Reviewed by Cursor Bugbot for commit 98008a9. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR tightens the fileAttachment.maxBytes ceilings for two providers in models.ts to align with documented provider constraints.

  • Gemini: reduced from 100 MB to 50 MB, matching the Gemini File API's documented 50 MB hard cap on PDFs — previously a 50–100 MB PDF would pass the client-side gate, be uploaded, then fail at generateContent.
  • vLLM: reduced from 50 MB to 25 MB, aligning with the default 5-second VLLM_IMAGE_FETCH_TIMEOUT and matching the Baseten provider ceiling.

Confidence Score: 5/5

  • Safe to merge — two numeric constant corrections with no logic changes, unit tests pass, and the values now match documented provider limits.
  • Both changes reduce ceiling values to documented provider limits, eliminating late-stage failures where files would pass the client gate, get uploaded, and then be rejected by the provider API. The diff touches only two constant expressions in a single file; no control flow, type definitions, or external interfaces are affected.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/sim/providers/models.ts Two maxBytes constants tightened: Gemini 100MB→50MB (respects PDF hard cap) and vLLM 50MB→25MB (aligns with default 5s fetch timeout). No logic or structural changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[File Attachment Upload Request] --> B{Check maxBytes gate}
    B -->|File size exceeds limit| C[Reject early with clear error]
    B -->|File size within limit| D{Provider strategy?}
    D -->|Gemini: files-api\n≤ 50 MB| E[Upload to Gemini File API\nPoll for ACTIVE state\ncall generateContent ✅]
    D -->|vLLM: remote-url\n≤ 25 MB| F[Pass URL to vLLM\nFetched within 5s timeout ✅]
    D -->|Other providers| G[Provider-specific handling]
    style C fill:#f66,color:#fff
    style E fill:#6c6,color:#fff
    style F fill:#6c6,color:#fff
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[File Attachment Upload Request] --> B{Check maxBytes gate}
    B -->|File size exceeds limit| C[Reject early with clear error]
    B -->|File size within limit| D{Provider strategy?}
    D -->|Gemini: files-api\n≤ 50 MB| E[Upload to Gemini File API\nPoll for ACTIVE state\ncall generateContent ✅]
    D -->|vLLM: remote-url\n≤ 25 MB| F[Pass URL to vLLM\nFetched within 5s timeout ✅]
    D -->|Other providers| G[Provider-specific handling]
    style C fill:#f66,color:#fff
    style E fill:#6c6,color:#fff
    style F fill:#6c6,color:#fff
Loading

Reviews (2): Last reviewed commit: "improvement(providers): tighten Gemini a..." | Re-trigger Greptile

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 16, 2026 5:26pm

Request Review

@waleedlatif1 waleedlatif1 merged commit 2b7f57a into staging Jun 16, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/provider-attachment-limits branch June 16, 2026 17:27
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 98008a9. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant