Truncate embedding input by tokens at the model's window, not by a character cap
メンテナーはふだん 1 日以内に返信
@kriszyp がすでに取り組んでいます。
2026年10月28日 から。
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- JavaScript
- スター
- 0
- フォーク
- 0
- 平均マージ
- 20時間 29分
- マージ済み PR(30日)
- 28
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
HarperFast/agent-memory のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
HarperFast/agent-memory#17 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
HarperFast/agent-memory#54 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
HarperFast/agent-memory#53 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
HarperFast/agent-memory#48 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
HarperFast/agent-memory#47 ·
メンテナーはふだん 1 日以内に返信
HarperFast/agent-memory の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
ACK_WAITING HELP_WANTED UPDATE_CS
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OWASP/CheatSheetSeries#3000 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
fishjar/kiss-translator#1381 ·
メンテナーはふだん 1 日以内に返信
-
Client execution contract accepts a grant the code never takes対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: client enhancement priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
opensro-dev/opensro#3808 ·
メンテナーはふだん 1 日以内に返信