Skip to content

Conversation

@LHT129
Copy link
Collaborator

@LHT129 LHT129 commented Sep 25, 2025

Summary by Sourcery

Add standalone Python example scripts for HNSW, HGraph, and brute-force indexes and remove the old placeholder examples.

New Features:

  • Provide a Python example demonstrating HNSW index creation, building, and k-NN search.
  • Provide a Python example demonstrating HGraph index creation, building, and k-NN search.
  • Provide a Python example demonstrating brute-force index creation, building, and k-NN search.

Chores:

  • Remove deprecated placeholder scripts from the todo_examples directory.

@LHT129 LHT129 self-assigned this Sep 25, 2025
@LHT129 LHT129 added kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) version/0.17 labels Sep 25, 2025
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 25, 2025

Reviewer's Guide

This PR migrates working Python example scripts for HNSW, HGraph, and brute-force indices into the main examples directory with full create/build/search demos, cleans up the legacy todo_examples placeholders, and applies a minor formatting fix to the diskann example license header.

Sequence diagram for index creation, build, and search in Python examples

sequenceDiagram
    actor User
    participant Script
    participant pyvsag
    User->>Script: Run example script
    Script->>pyvsag: Create Index (type, params)
    Script->>pyvsag: Build Index (vectors, ids, num_elements, dim)
    Script->>pyvsag: knn_search(vector, k, parameters)
    pyvsag-->>Script: Return result_ids, result_dists
    Script->>User: Print results
Loading

File-Level Changes

Change Details Files
Add complete Python example scripts for various index types
  • Demonstrate dataset generation and ID assignment with numpy
  • Showcase index creation with pyvsag.Index for each algorithm
  • Illustrate building and querying (knn_search) flow with parameters
  • Include Apache-2.0 license header in each example
examples/python/101_index_hnsw.py
examples/python/103_index_hgraph.py
examples/python/105_index_brute_force.py
Remove outdated placeholder scripts
  • Delete stub example files for indices 101, 103, and 105 in todo_examples
examples/python/todo_examples/101_index_hnsw.py
examples/python/todo_examples/103_index_hgraph.py
examples/python/todo_examples/105_index_brute_force.py
Fix license formatting in diskann example
  • Ensure newline at end of file to comply with formatting standards
examples/python/todo_examples/102_index_diskann.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main    #1190      +/-   ##
==========================================
- Coverage   91.88%   91.82%   -0.06%     
==========================================
  Files         312      312              
  Lines       18682    18682              
==========================================
- Hits        17166    17155      -11     
- Misses       1516     1527      +11     
Flag Coverage Δ
cpp 91.82% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
common 91.57% <ø> (ø)
datacell 92.69% <ø> (+0.32%) ⬆️
index 90.41% <ø> (-0.44%) ⬇️
simd 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f10d8b8...b060b1d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) size/L version/0.18

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant