Add embedder auto-truncation and settings serialization#78
Merged
Conversation
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.
EmbedderOpenAInow auto-truncates input toSettings.embedder_token_limittokensbefore every API call (per-instance overrides via constructor). The
context_truncatorplumbing was removed from
Index/KnowledgeGraph— truncation now lives inside the embedder.Search engines no longer accept
max_context_length/tokenizer_backend/tokenizer_model;BaseEnginereads these fromSettings.TokenTruncation(local backend) now accounts for special tokens ([CLS]/[SEP]),fixing silent over-limit requests against BGE/E5-style models.
Settings.save(path)/Settings.load(path)— JSON serialization of the config(Literal/int/str validation;
storage_folderdeliberately excluded) for reproducible runs.Centralized tokenizer & token-limit configuration in the
Settingssingleton:new typed fields
tokenizer_embedder_backend,tokenizer_llm_backend,tokenizer_embedder_name,tokenizer_llm_name,embedder_token_limit,llm_token_limit,llm_context_token_limit(withLiteral["tiktoken","local"]validation).Bugfix: SQLite
database disk image is malformedcorruption resolved viasqlite_synchronous=2.New example
examples/local_embedder_with_short_context.py(local vLLM embedder, 512-token context);README, AGENTS.md and subpackage READMEs updated.