fix(analysis): raise default ANALYSIS_MAX_TOKENS 900 -> 4096
A text-dense page's full analysis JSON exceeded the 900-token output cap,
so the model stopped mid-object (finish_reason: length) and the truncated
response failed to parse ("EOF while parsing a list"). The page image +
prompt are only a few hundred tokens, so a larger output budget still fits
comfortably in an 8k context window. Still overridable via
ANALYSIS_MAX_TOKENS.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,10 @@ pub struct AnalysisConfig {
|
||||
/// Whole-job timeout in the worker (`ANALYSIS_JOB_TIMEOUT_SECS`).
|
||||
pub job_timeout: Duration,
|
||||
/// Output token cap sent as `max_tokens` (`ANALYSIS_MAX_TOKENS`).
|
||||
/// Must be generous enough to hold the full JSON for a text-dense page
|
||||
/// — too low truncates the response mid-object (`finish_reason:
|
||||
/// length`) and the parse fails. The page image + prompt are only a few
|
||||
/// hundred tokens, so a large output budget still fits an 8k window.
|
||||
pub max_tokens: u32,
|
||||
/// Longest image edge (px) before downscaling (`ANALYSIS_MAX_IMAGE_DIM`).
|
||||
pub max_image_dim: u32,
|
||||
@@ -134,7 +138,7 @@ impl Default for AnalysisConfig {
|
||||
api_key: None,
|
||||
request_timeout: Duration::from_secs(120),
|
||||
job_timeout: Duration::from_secs(180),
|
||||
max_tokens: 900,
|
||||
max_tokens: 4096,
|
||||
max_image_dim: 1024,
|
||||
max_image_bytes: 8 * 1024 * 1024,
|
||||
response_format: ResponseFormat::JsonSchema,
|
||||
|
||||
Reference in New Issue
Block a user