Skip to content

feat(config): configurable image-analysis token budget and round cap#20

Open
flobernd wants to merge 1 commit into
profile-routingfrom
image-analysis-limits
Open

feat(config): configurable image-analysis token budget and round cap#20
flobernd wants to merge 1 commit into
profile-routingfrom
image-analysis-limits

Conversation

@flobernd

Copy link
Copy Markdown
Owner

Summary

The per-profile image_analysis block gains two knobs: max_tokens (default 8192) sets the analyzer's completion budget, replacing a hardcoded 4096 that starved thinking-enabled analyzers into missing-content errors on dense multi-image analyses; max_rounds (default 8) bounds analyzeImage rounds per turn, replacing the hard-coded ceiling. Zero is a startup error for either field; both are documented in the README.

Testing

Full cargo test green (740 lib + 165 gateway + 22 image_agent + 21 port_config plus the rest, 0 failed), cargo fmt --check clean, cargo clippy --all-targets zero warnings. Parse tests cover defaults, explicit values, and the zero errors; wire tests assert the configured max_tokens lands in the analyzer POST body and that max_rounds: 1 fails the second analysis round with the existing round-limit error.

Notes

Stacked on local-inference-lab#36's branch; retarget or rebase once that merges. max_tokens has no upper bound beyond the type; a value at or above 2^63 would wrap negative and be rejected by the upstream, which is fail-safe.

The analyzer completion budget was a hardcoded 4096 max_tokens; a
thinking-enabled analyzer can spend that whole budget on reasoning before
emitting any content, which surfaced as a missing-content analyzer error
with no way to raise the ceiling. The analyzeImage round cap was likewise
a local hard-coded constant (8), independent of any per-profile config.

Add image_analysis.max_tokens (default 8192) and image_analysis.max_rounds
(default 8) to ImageAnalysisConfig, validated at startup (0 rejected for
either field, naming the profile key). ActiveVisionSession now carries both
values from the resolved profile; analyze_images_via_upstream posts the
configured max_tokens instead of the literal 4096, and the round-ceiling
check reads the session's max_rounds, with the old 8 surviving only as the
serde default.
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