feat: add load_export() reader API#68
Merged
Merged
Conversation
Adds load_export(path) as the read-side counterpart to export_batch(), closing the write/read asymmetry where users had to manually parse NPZ keys and manifest JSON to recover their embeddings. - Auto-detects combined (single file) vs per-item (directory) layout - Returns ExportResult with per-model ModelResult entries - NaN-fills failed points in partial runs; surfaces status="partial" - result.embedding(model) typed shortcut; ok_models / failed_models - ExportResult and ModelResult exported from rs_embed top-level - 45 unit tests covering both layouts, error cases, partial failures - New docs page at docs/api_load.md with full API reference and examples - Removes legacy private re-exports from api.py - Fixes pre-commit hook name: ruff -> ruff-check
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
Closes #17.
Adds
load_export(path)as the read-side counterpart toexport_batch(), closing the write/read asymmetry where users had to manually parse NPZ array keys and JSON manifests to recover their embeddings.The loop is now symmetric:
Changes
src/rs_embed/load.py— new module implementingload_export,ExportResult, andModelResult.npz/.ncfile) vs per-item (directory) layoutstatus="partial"result.embedding(model)typed shortcut;ok_models/failed_modelsconvenience propertiesxarrayimportsrc/rs_embed/__init__.py— exportsload_export,ExportResult,ModelResultat top levelsrc/rs_embed/api.py— removes legacy private re-exports (_default_provider_backend_for_apietc.) that were kept with# noqa: F401tests/test_load_export.py— 45 unit tests covering both layouts, path routing, partial failures, NaN fill, two-model runs, and error casestests/test_backend_resolution.py— updated to import from canonical location (tools/normalization) now that the api.py re-exports are gonedocs/api_load.md— new docs page with full API reference, data structure docs, and usage examplesdocs/api.md,docs/api_export.md,mkdocs.yml— nav and cross-links updatedCHANGELOG.md—[Unreleased]entry added.pre-commit-config.yaml— fixes hook idruff→ruff-check(the non-legacy name)Test plan
python -m pytest tests/test_load_export.py -v— all 45 tests passpython -m pytest— full suite (570 tests) passespre-commit run --all-files— prettier, ruff-check, ruff-format all passmkdocs build --strict— docs build clean (pre-existingextending.mderror unrelated to this PR)