Repository navigation
Fix malformed embedding recovery - #8
Merged
AliZakaee merged 1 commit intoAug 15, 2026
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.
Summary
Why this is meaningful
The loader already promises to ignore malformed embedding rows, but a correctly sized JSON list containing a non-numeric value raised during the final NumPy conversion. That exception escaped the retrieval layer and could abort both the incoming customer-response pipeline and the owner's knowledge-base search. Validating per row preserves healthy vectors and lets an all-invalid set use the existing keyword fallback.
Validation
python -m pytest tests/unit/services/test_embedding_service.py -q— 13 passedpython -m pytest— 283 passedpython -m pytest --cov=. --cov-report=term-missing --cov-report=xml --cov-report=html --junitxml=junit.xml— 283 passed, 61% total coveragepython -m compileall -q config.py database.py handlers services security.py telegram_api.py utils.py— passedgit diff --check— passedRisk and rollback
Risk is low: valid finite embeddings retain the same float32 representation, while only unusable rows are filtered earlier. Revert commit
5ac50d2to roll back.Prepared with automated assistance by EQ for AliZakaee.