Truncate embedding input by tokens at the model's window, not by a character cap
Los mantenedores suelen responder en 1 día
@kriszyp ya está trabajando en esto.
Desde el 28/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 0
- Forks
- 0
- Merge medio
- 20 h 29 min
- PR fusionados (30 d)
- 28
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de HarperFast/agent-memory
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
HarperFast/agent-memory#17 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 18/100
HarperFast/agent-memory#54 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
HarperFast/agent-memory#53 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 52/100
HarperFast/agent-memory#48 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
HarperFast/agent-memory#47 ·
Los mantenedores suelen responder en 1 día
Todos los issues de HarperFast/agent-memory
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
ACK_WAITING HELP_WANTED UPDATE_CS
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
OWASP/CheatSheetSeries#3000 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
fishjar/kiss-translator#1381 ·
Los mantenedores suelen responder en 1 día
-
Client execution contract accepts a grant the code never takesPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea: client enhancement priority: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
opensro-dev/opensro#3808 ·
Los mantenedores suelen responder en 1 día