Skip to content

feat: keep requests under the endpoint byte limit by stripping oldest images#281

Open
mlikasam-askui wants to merge 2 commits into
mainfrom
feat/request-byte-budget-truncation
Open

feat: keep requests under the endpoint byte limit by stripping oldest images#281
mlikasam-askui wants to merge 2 commits into
mainfrom
feat/request-byte-budget-truncation

Conversation

@mlikasam-askui
Copy link
Copy Markdown
Contributor

@mlikasam-askui mlikasam-askui commented Jun 2, 2026

Strip oldest base64 images from history when a request would exceed the endpoint's ~30 MB byte limit. Adds request-size estimation, a per-provider max_request_bytes, and budget enforcement in SummarizingTruncationStrategy (skipped when no limit is defined).

Jira: SOLENG-369

provider_options: dict[str, Any] | None = None,
) -> MessageParam:
estimated_bytes = estimate_messages_bytes(messages)
if estimated_bytes > ANTHROPIC_MAX_REQUEST_BYTES:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't like that we estimate the Request side. I would prefere to deal with the Error. And then do the Truncation strategy.

Otherwise we don't know if the LLM Provider is inceasing theire 30 MB Limit

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.

2 participants