Repository navigation
feat(embedder): make embedding batch limits configurable - #399
Merged
Merged
Conversation
Add `embedder.max_batch_size` and `embedder.max_batch_tokens` for the openai provider. OpenAI-compatible endpoints often reject or time out on the OpenAI-sized batches (2000 inputs / 280000 tokens). The limits drive batch formation during initial indexing and are now also applied by EmbedBatch, used by the watcher. Unset values keep the previous limits. Closes #92 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GNtGZcXfz7hyZsrgHrdzuj
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.
Summary
Adds
embedder.max_batch_sizeandembedder.max_batch_tokens(openai provider). OpenAI-compatible endpoints (vLLM, TEI, proxies, Ollama/v1…) often time out or fail on the OpenAI-sized batches (2000 inputs / 280000 estimated tokens); users had to put a splitting proxy in front.Changes
config: twoomitemptyfields; unset/0 keeps the previous limits.embedder/batch.go:BatchLimits,DefaultBatchLimits(),FormBatchesWithLimits()(FormBatchesunchanged, uses the defaults), optionalBatchLimiterinterface.OpenAIEmbedder:WithOpenAIBatchLimitsoption,BatchLimits(), andEmbedBatch(watcher path, one file per call) now splits into several requests when a file exceeds the limits, preserving order.indexer:IndexAllforms batches with the embedder's limits.configuration.md,backends/embedders.md) and CHANGELOG.FormBatches,EmbedBatchsplitting + ordering, factory wiring, YAML load, and default config not writing the new keys.Test Plan
make lint: 0 issues.go test -race ./...: all green.provider: openaipointed at Ollama's OpenAI-compatible endpoint (nomic-embed-text) through a request-logging proxy:main(defaults)max_batch_size: 50,max_batch_tokens: 20000)Watcher: adding a file with 84 new chunks under
grepai watchproduced 3 requests (38/38/8 inputs, ≤ 20000 est. tokens).mainand this PR send byte-identical batches (495 / 604 / 607 inputs). Default config does not gain the new keys on save (tested).Closes #92
🤖 Generated with Claude Code
https://claude.ai/code/session_01GNtGZcXfz7hyZsrgHrdzuj