Skip to content

fix(embedding): reject text over the model token limit - #20

Merged
HarshMN2345 merged 7 commits into
masterfrom
fix-embedding-context-length
Nov 18, 2026
Merged

HarshMN2345 merged 7 commits into
masterfrom
fix-embedding-context-length

docs: document the token limit error

a96bc8f
Select commit
Loading
Failed to load commit list.
Appwrite / Hansi succeeded Nov 18, 2026 in 26s

Tier S: Ready to merge

The changed rejection path validates the full untruncated token count before inference and returns the intended 400 response.

The service now applies each model’s context limit, capped by EMBEDDING_MAX_TOKENS, and rejects over-limit input with a 400 before running inference. It counts unpadded input tokens, sizes inference sub-batches according to the configured limit, and documents the limits and memory guidance. Tests cover model-specific limits, rejection, and token counting.