Fix local knowledge search notebook API drift against SDK v0.5.7#3
Open
tatavishnurao wants to merge 1 commit into
Open
Fix local knowledge search notebook API drift against SDK v0.5.7#3tatavishnurao wants to merge 1 commit into
tatavishnurao wants to merge 1 commit into
Conversation
Replace stale API references in 0_local_knowledge_search_walkthrough.ipynb: - HnswIndex -> VectorIndex - m= -> max_connections= - metric= kwarg removed (not a constructor param) - insert_batch_with_ids() -> insert_batch() - search() returns List[Tuple[int,float]], not two arrays
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.
Fix notebook API drift against
sochdb==0.5.7Summary
This PR updates
0_local_knowledge_search_walkthrough.ipynbto use the current public SochDB Python SDK API.The notebook was still using the older/internal HNSW-facing API shape:
HnswIndexm=...metric=...insert_batch_with_ids(...)search(...)unpacked as(ids, distances)The current SDK exposes the vector index through
VectorIndex, with batch insertion viainsert_batch(...), andsearch(...)returning a list of(id, distance)tuples.Changes
1. Replace
HnswIndeximport withVectorIndexinstead of:
2. Update vector index construction
instead of using the older constructor shape with
m/metric.3. Update batch insertion API
instead of:
4. Update search result handling
VectorIndex.search(...)returns:So the notebook now normalizes results like this:
instead of unpacking search output as two separate arrays.
5. Remove non-existent package install cell
Removed the
!uv pip install sochdb-hnswindexcell since that package does not exist on PyPI. The HNSW vector index is included in the basesochdbpackage.Why
The notebook currently fails for users running against the public SDK because it references API members that are not exposed by
sochdb==0.5.7.This PR keeps the walkthrough aligned with the SDK surface area and makes the notebook runnable for users following the repository instructions.
Verification
Verified the SDK export surface:
python -c "import sochdb; print([x for x in dir(sochdb) if 'Index' in x])"Expected output:
['VectorIndex']Also verified the vector module exposes the expected index implementation:
python -c "import sochdb.vector as v; print([x for x in dir(v) if not x.startswith('_')])"Expected to include:
Files changed
0_local_knowledge_search_walkthrough.ipynbNotes
This does not change notebook behavior or the underlying indexing algorithm. The HNSW implementation is still used under the hood; the public Python API exposes it as
VectorIndex.