You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(pipeline): embed() called with all chunks in one batch, causing OOM or API rejection on large documents #247
pipeline.py calls embedder.embed([chunk.text for chunk in chunks]) with all chunks in a single batch and no size limit. A large document (500+ pages) can produce thousands of chunks, exceeding the OpenAI API's per-request token budget or exhausting BgeM3's GPU/CPU memory — causing the entire ingest to fail.
OpenAI's embeddings API has a per-request token limit. BgeM3 processes all texts simultaneously in a single matrix operation. Neither embedder has an internal chunking loop.
Failure Scenario
Tenant uploads a 400-page technical manual producing 3,000 chunks.
embedder.embed(all_3000_texts) is called.
OpenAI rejects the request (payload too large) → ingest fails with APIError.
Or: BgeM3 attempts to allocate a 3,000 × 1024 float32 matrix → MemoryError.
Document is permanently in ingest_status='pending' with no sections.
Activity
piyushmakhija28 commentedon Jun 21, 2026
Fixed in PR #280 (Sprint R3/R4: fix(sprint-r3): root-cause fixes for all 39 bugs from code review round 3 + Sprint R4 round 4)