fix(embed): add text chunking for oversized embedding inputs (#616)#642
Merged
MaojiaSheng merged 1 commit intovolcengine:mainfrom Mar 16, 2026
Merged
fix(embed): add text chunking for oversized embedding inputs (#616)#642MaojiaSheng merged 1 commit intovolcengine:mainfrom
MaojiaSheng merged 1 commit intovolcengine:mainfrom
Conversation
Contributor
lgYanami
commented
Mar 15, 2026
…ine#616) - Add _estimate_tokens, _chunk_text, _chunk_and_embed to EmbedderBase - Override embed()/embed_batch() in OpenAIDenseEmbedder with auto-chunking - Use tiktoken for accurate token counting, fallback to char estimation - Merge chunk vectors via token-weighted average + L2 normalization - Make max_tokens configurable via ov.conf (embedding.dense.max_tokens) - Default 8000 for OpenAI models, users can override for other models - Add 22 unit tests covering chunking, fallback, batch, config
MaojiaSheng
approved these changes
Mar 16, 2026
Collaborator
|
我们计划回滚这个 PR。 #616 的根因不是 embedder 缺少分块能力,而是 其他资源类型(Markdown、PDF 等)在 parser 阶段就按结构切片,每个 L2 切片都在 embedding 窗口内。代码仓库文件是唯一跳过 parser 切片、直接把原始全文送进 embedder 的类型(
计划:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.