Truncate embedding input by tokens at the model's window, not by a character cap
I maintainer di solito rispondono entro 1 giorno
@kriszyp ci sta già lavorando.
Dal 28/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Problem
limits.embeddingInputChars (added in 0.1.2, branch fix/bound-embedding-input) cuts every embedding input to a character count, default 6,000. Characters are a proxy for tokens, and it misses in both directions:
- Too long for token-dense text. 6,000 characters of CJK text (about 1 token per character) or code (about 3 characters per token), plus any task prefix a host backend adds, can still exceed a 2,048-token window. The backend answers HTTP 400, and the write fails with a 500 as before.
- Too short for large windows. A model that holds 8k tokens embedded a 20,000-character memory whole before 0.1.2. With the default it now embeds only the first 6,000 characters, so vector recall on the tail is lost unless the operator raises the cap. Full-text search still covers the tail.
Proposal
Truncate by tokens at the model's window, in Harper core. Add an EmbedOpts truncation option (for example truncate: 'end'), which the openai backend forwards as vLLM's truncate_prompt_tokens and other backends honor as they can. Today the openai backend builds { model, input } only, so a plugin cannot ask for this. Once core supports it, the plugin passes the option and keeps the character cap only as a backstop for backends without truncation, with a default that no longer affects large-window models.
Related: Re-embed memories when embeddingModel changes vector size. Changing the bound does not re-embed existing rows either.
Review-Deferral: 1913aa1ba8c0ab82 severity=minor category=correctness
🤖 Generated by Claude Opus 5.5 (Anthropic, Claude Code dev-agent); posted via @kriszyp.
- Lingua principale
- JavaScript
- Stelle
- 0
- Fork
- 0
- Merge medio
- 20h 29m
- PR unite (30g)
- 28
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HarperFast/agent-memory
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
HarperFast/agent-memory#17 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 18/100
HarperFast/agent-memory#54 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
HarperFast/agent-memory#53 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
HarperFast/agent-memory#48 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
HarperFast/agent-memory#47 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di HarperFast/agent-memory
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
ACK_WAITING HELP_WANTED UPDATE_CS
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
OWASP/CheatSheetSeries#3000 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
fishjar/kiss-translator#1381 ·
I maintainer di solito rispondono entro 1 giorno
-
Client execution contract accepts a grant the code never takesForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea: client enhancement priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
opensro-dev/opensro#3808 ·
I maintainer di solito rispondono entro 1 giorno