Truncate embedding input by tokens at the model's window, not by a character cap
Les mainteneurs répondent en général sous 1 jour
@kriszyp y travaille déjà.
Depuis le 28/10/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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.
- Langage dominant
- JavaScript
- Étoiles
- 0
- Forks
- 0
- Merge moyen
- 20 h 29 min
- PR mergées (30 j)
- 28
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de HarperFast/agent-memory
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
HarperFast/agent-memory#17 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 18/100
HarperFast/agent-memory#54 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
HarperFast/agent-memory#53 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 52/100
HarperFast/agent-memory#48 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
HarperFast/agent-memory#47 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de HarperFast/agent-memory
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
ACK_WAITING HELP_WANTED UPDATE_CS
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
OWASP/CheatSheetSeries#3000 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
fishjar/kiss-translator#1381 ·
Les mainteneurs répondent en général sous 1 jour
-
Client execution contract accepts a grant the code never takesPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertearea: client enhancement priority: medium
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
opensro-dev/opensro#3808 ·
Les mainteneurs répondent en général sous 1 jour