Refresh stored embedding rows when store or metadata changes#1513
Open
dpersek wants to merge 1 commit into
Open
Refresh stored embedding rows when store or metadata changes#1513dpersek wants to merge 1 commit into
dpersek wants to merge 1 commit into
Conversation
Refresh stored content, content_blob, and metadata for exact existing embedding rows without recomputing embeddings. Preserve normal insert and replace behavior for new IDs or changed content, with regression coverage for the edge cases found during review. Fixes simonw#224.
dpersek
marked this pull request as ready for review
July 4, 2026 20:43
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
content,content_blob, andmetadatawhen repeat embedding calls target an existing row with the same ID and content hashWhy
Fixes #224.
The existing
embed()andembed_multi_with_metadata()paths can notice that acontent_hashis already present and skip work before updating stored content or metadata. That makes rerunningembed/embed-multiwith--storeor new metadata leave the stored columns stale.Tests
uv run --group dev pytest tests/test_embed.py -k "updates_store_and_metadata_for_existing_hash or updates_content_blob_for_existing_hash or embed_inserts_new_id_for_existing_hash or existing_hash_refresh_only_updates_matching_id or embed_multi_inserts_new_id_for_existing_hash or embed_multi_updates_changed_id_when_old_hash_is_in_batch": 7 passed, 15 deselecteduv run --group dev pytest tests/test_embed.py: 22 passeduv run --group dev pytest tests/test_embed_cli.py: 91 passeduv run --group dev ruff check llm/embeddings.py tests/test_embed.py: passeduv run --group dev black --target-version py312 --check llm/embeddings.py tests/test_embed.py: 2 files unchangedgit diff --check: passeduv run --group dev pytest: 789 passedScope