feat(config): configurable image-analysis token budget and round cap#20
Open
flobernd wants to merge 1 commit into
Open
feat(config): configurable image-analysis token budget and round cap#20flobernd wants to merge 1 commit into
flobernd wants to merge 1 commit into
Conversation
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.
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
The per-profile
image_analysisblock 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) boundsanalyzeImagerounds per turn, replacing the hard-coded ceiling. Zero is a startup error for either field; both are documented in the README.Testing
Full
cargo testgreen (740 lib + 165 gateway + 22 image_agent + 21 port_config plus the rest, 0 failed),cargo fmt --checkclean,cargo clippy --all-targetszero warnings. Parse tests cover defaults, explicit values, and the zero errors; wire tests assert the configuredmax_tokenslands in the analyzer POST body and thatmax_rounds: 1fails 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_tokenshas 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.