Repository navigation
Replies: 1 comment 1 reply
|
Checked on master
I ran those exact functions on your captures:
So the clamp does fire and still emits a 4096-pixel long edge — a number that cannot satisfy a 3000-pixel limit. Your 1440×3900 row (755×2044) matches the projection exactly, so this is the code's arithmetic, not an estimate. Two structural points worth putting in the PR:
One thing to settle before the patch: that comment claims 4096 is the many-image limit, while the endpoint's 400 says 3000. Both cannot be true for the same endpoint, so quote the error text in the PR — otherwise the value gets "fixed" back to 4096 by whoever reads the comment. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Bug report + patch: a full-page screenshot makes every later turn fail on Messages endpoints
Branch with the fix:
Jdrg4:fix/llm-deepseek-image-max-dimension(one commit)Symptom
Once a conversation accumulates a tall screenshot, every later turn fails, even turns that carry no new image:
The whole turn is lost; the conversation cannot continue without dropping the history. It reproduces with the screenshots an agent takes itself: a 390×6400 or 520×6400 full-page capture.
Root cause
packages/llm/llm-deepseek/src/request-pricing.tscaps every request image at one per-side limit:That is the DeepSeek endpoint's many-image limit. Anthropic's Messages API caps many-image requests at 3000 pixels per side and rejects the whole request over one oversized image, so any target the adapter projects above 3000 is a request the endpoint must refuse.
Measured with the current projection (no API key needed,
resolveRequestImageTarget):The grid already shrinks a wide capture below the limit; a tall one (a full-page mobile screenshot) projects above 3000 and the 4096 cap leaves it there. That is why the failure appears only after some captures, and then poisons every later turn.
The per-side limit is also the only image limit that is not per model —
imagePixelBudgetandimageMaxBytesare already per catalog entry.Patch
Image-capable catalog entries may declare
imageMaxDimension; omission keeps 4096, so DeepSeek routes and every existing configuration are unchanged.types.ts—imageMaxDimension?: numberonDeepSeekCatalogModel.request-pricing.ts—resolveRequestImageMaxDimension(model)besideresolveRequestImageMaxBytes;resolveRequestImageTargetuses it.config.ts— schema field, resolution into the validated connection (?? REQUEST_IMAGE_MAX_DIMENSION), and the same guard asimageMaxBytes(positive safe integer, rejected on a text-only entry).README.md/README.zh.md/README.i18n.yaml— document the field, including that Anthropic's Messages API needs3000.With
models: [{ id: 'claude-…', inputModalities: ['text', 'image'], imageMaxDimension: 3000 }], a 390×6400 capture is projected to 183×3000 and the request succeeds.Verification
Not run:
test:coverage(repo-wide gate) andbuild. The change adds no dependency and no public export beyond the catalog field.Question for the maintainers
Is a per-model field the shape you want, or would you rather a connection-level field (one Messages endpoint, one limit) or a different default for Messages-compatible endpoints? I can reshape the patch either way — it is one commit.
I did not open a pull request:
CONTRIBUTING.mdstates the project cannot accept external pull requests at the moment, and the repository has Issues disabled, so there is no issue for a PR description to reference. This report is the contribution; the branch is ready to cherry-pick if you want it.All reactions