Skip to content

fix(inference): raise scene_prompt max_length 4096 → 32768#67

Merged
Liuhaai merged 1 commit into
mainfrom
fix/scene-prompt-max-length
May 14, 2026
Merged

fix(inference): raise scene_prompt max_length 4096 → 32768#67
Liuhaai merged 1 commit into
mainfrom
fix/scene-prompt-max-length

Conversation

@Liuhaai

@Liuhaai Liuhaai commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • CropDescribeRequest.scene_prompt was capped at 4096 chars, but production cortex sends prompts in the 4.4-5.2 KB range when the KNOWN REGULARS list for a busy camera includes 50+ entities.
  • Result: ~6 Pydantic 422s per minute on /api/inference/crop-describe (string_too_long at body.scene_prompt), each dropping a frame.
  • Raising to 32 KB gives ~6× headroom and is consistent with the field shape — image_b64 already allows 14 MB.

Test plan

  • Local probe against running inference server: scene_prompt=5000 chars previously returned 422 string_too_long; will accept under new limit.
  • Existing schema validation still rejects oversized prompts (now at the 32 KB boundary).
  • After merge: confirm 422 rate on /api/inference/crop-describe drops to ~0 in cortex prod logs (/tmp/cortex.log cortex.vlm rejected).

🤖 Generated with Claude Code

The 4096-char cap rejected ~6 req/min in production with a Pydantic
422 (string_too_long). Cortex's crop-describe caller sends prompts in
the 4.4-5.2 KB range when the KNOWN REGULARS list for a busy camera
includes 50+ entities — the cap had no security or storage motivation,
just an under-estimate of real prompt sizes.

Bumping to 32 KB gives ~6× headroom over current usage and is still
trivially small next to the image_b64 field (max 14 MB).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Liuhaai Liuhaai merged commit 8659ad0 into main May 14, 2026
7 checks passed
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