bge-multilingual-gemma2 takes 8192 tokens; on prod (16 and 22 Oct, 7
each) a batch of 16 code chunks came to ~51k and was refused, so the
repo's embedding build failed (backlog t26). Chunks are capped at 2048
estimated tokens, but at 4 chars per token, which undercounts code, and
16 of them went into one request.
embed() now plans batches by input count (16) and an estimated token
budget (7000 per request, 3 bytes per token), and cuts a single text
that would not fit alone at a char boundary (the head keeps the context
header and signature). Order is kept across batches.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4