feat: batch embedding with local filesystem cache#81
Merged
Conversation
…hing Server startup was blocked for ~20 minutes embedding ~1800 EIP chunks one HTTP request at a time. This change: - Batch embeds all index items (examples, runbooks, EIPs) via EmbedBatch - Splits large batches into sub-batches of 50 (server) / 100 (proxy) - Adds a local filesystem cache (pkg/cache/filesystem.go) so warm restarts avoid proxy round-trips entirely (~55MB of vectors) - Cache keys include model name for automatic invalidation on model change - Adds 500-item hard cap on proxy /embed endpoint - Removes the broken EIP-local vector cache (no model awareness) - Improves info-level logging throughout the embedding pipeline
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
Embedding was doing one HTTP call per item — about 1800 sequential requests for EIPs alone, which took ~20 minutes and blocked the server from starting. Now all index builders (examples, runbooks, EIPs) use
EmbedBatch, split into sub-batches of 50 on the server side and 100 on the proxy side. A new filesystem cache (pkg/cache/filesystem.go) stores vectors locally keyed by{model}:{textHash}, so warm restarts skip the proxy entirely. The proxy/embedendpoint is capped at 500 items and the old EIP vector cache (which didn't track model identity) is gone. Also added actual info-level logging so you can tell what's happening during startup.